You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/17 12:46:59 UTC
[32/50] [abbrv] incubator-taverna-plugin-bioinformatics git commit:
taverna-biomoby-activity-ui/
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyObjectActionHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyObjectActionHelper.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyObjectActionHelper.java
deleted file mode 100644
index 9ff9d67..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyObjectActionHelper.java
+++ /dev/null
@@ -1,787 +0,0 @@
-/*
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.Vector;
-
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JProgressBar;
-import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
-import javax.swing.JTree;
-import javax.swing.ToolTipManager;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.MutableTreeNode;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeSelectionModel;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivity;
-import net.sf.taverna.t2.activities.biomoby.edits.AddBiomobyConsumingServiceEdit;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-
-import org.apache.log4j.Logger;
-import org.biomoby.client.CentralImpl;
-import org.biomoby.registry.meta.Registry;
-import org.biomoby.shared.Central;
-import org.biomoby.shared.MobyData;
-import org.biomoby.shared.MobyDataType;
-import org.biomoby.shared.MobyException;
-import org.biomoby.shared.MobyNamespace;
-import org.biomoby.shared.MobyPrimaryDataSet;
-import org.biomoby.shared.MobyPrimaryDataSimple;
-import org.biomoby.shared.MobyService;
-import org.biomoby.shared.data.MobyDataInstance;
-import org.biomoby.shared.data.MobyDataObject;
-import org.biomoby.shared.data.MobyDataObjectSet;
-
-public class BiomobyObjectActionHelper {
-
- private static Logger logger = Logger
- .getLogger(BiomobyObjectActionHelper.class);
-
- private boolean searchParentTypes = false;
-
- private OutputPort outputPort = null;
-
- private MobyNamespace[] namespaces = null;
-
- private EditManager editManager;
-
- private final FileManager fileManager;
-
- public BiomobyObjectActionHelper(boolean searchParentTypes, EditManager editManager, FileManager fileManager) {
- super();
- this.searchParentTypes = searchParentTypes;
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- public BiomobyObjectActionHelper(OutputPort outputPort, boolean searchParentTypes, EditManager editManager, FileManager fileManager) {
- super();
- this.searchParentTypes = searchParentTypes;
- this.outputPort = outputPort;
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- public BiomobyObjectActionHelper(EditManager editManager, FileManager fileManager) {
- super();
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- private class Worker extends Thread {
- private BiomobyObjectActivity activity;
-
- private BiomobyObjectActionHelper action;
-
- private JPanel panel = new JPanel(new BorderLayout());
-
- private JPanel namespacePanel = new JPanel(new BorderLayout());
-
- private JProgressBar bar = new JProgressBar();
-
- private JTree namespaceList = null;
-
- public Worker(BiomobyObjectActivity activity, BiomobyObjectActionHelper object) {
- super("Biomoby object action worker");
- this.activity = activity;
- this.action = object;
- }
-
- /*
- * method to show the progress bar
- */
- private void setUpProgressBar(String text) {
- bar = new JProgressBar();
- bar.setIndeterminate(true);
- bar.setValue(0);
- bar.setStringPainted(true);
- bar.setVisible(true);
- bar.setString(text);
- if (panel != null){
- panel.add(bar, BorderLayout.PAGE_END);
- panel.updateUI();
- }
- }
-
- private void takeDownProgressBar() {
- if (panel != null) {
- panel.remove(bar);
- panel.updateUI();
- }
-
- }
-
- public JPanel getPanel() {
- return this.panel;
- }
-
- public void run() {
- Central central = activity.getCentral();
- // ask if we should restrict query by namespace
- // only do this if we dont have an output port
- if (action.outputPort == null) {
- if (JOptionPane.YES_OPTION ==
- JOptionPane.showConfirmDialog(null, "Would you like to restrict your search by based upon a namespace?\n" +
- "This can allow you to find only those services that operate on a specific kind of data.",
- "Restrict query space", JOptionPane.YES_NO_OPTION)) {
- // create a JList chooser with a done button here
- setUpProgressBar("Getting namespaces list");
- try {
- namespacePanel = new JPanel(new BorderLayout());
- createNamespaceList(central.getFullNamespaces());
- JButton button = new JButton("Done");
- button.addActionListener(new ActionListener(){
- @SuppressWarnings("unchecked")
- public void actionPerformed(
- ActionEvent e) {
- ArrayList<MobyNamespace> chosen = new ArrayList<MobyNamespace>();
- TreePath[] paths = namespaceList.getSelectionPaths();
- for (TreePath p : paths) {
- if (p.getLastPathComponent() instanceof DefaultMutableTreeNode) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode)p.getLastPathComponent();
- if (node.isRoot()) {
- chosen = new ArrayList<MobyNamespace>();
- break;
- }
- if (!node.isLeaf()) {
- // get the children and add them to chosen
- Enumeration<DefaultMutableTreeNode> children = node.children();
- while (children.hasMoreElements() )
- chosen.add(new MobyNamespace(children.nextElement().toString()));
- } else {
- // is a leaf ... add to chosen
- chosen.add(new MobyNamespace(node.toString()));
- }
- }
- }
- // set the namespaces that were selected
- setNamespaces(chosen.toArray(new MobyNamespace[]{}));
- // get the tree - in a new thread
- Thread t = new Thread(){
- public void run() {
- namespacePanel.setVisible(false);
- setUpProgressBar("Getting BioMOBY details for " + activity.getConfiguration().getServiceName() + " ...");
- getSemanticServiceTree();
- }};
- t.setDaemon(true);
- t.start();
-
- }});
- // add the list and button to the panel
- namespacePanel.add(new JScrollPane(namespaceList), BorderLayout.CENTER);
- namespacePanel.add(button, BorderLayout.PAGE_END);
- panel.add(namespacePanel, BorderLayout.CENTER);
- panel.updateUI();
- } catch (MobyException e) {
- logger.error("", e);
- takeDownProgressBar();
- }
- takeDownProgressBar();
- // once done is pressed, insert selected namespace into the namespaces array
- // show the progress bar
-
- } else {
- // start our search
- setNamespaces(null);
- setUpProgressBar("Getting BioMOBY details for " + activity.getConfiguration().getServiceName() + " ...");
- getSemanticServiceTree();
- }
- } else {
- // search only for those services that consume the correct namespaces
- if (this.action != null && this.action.getNamespaces() != null) {
- setNamespaces(this.action.getNamespaces());
- } else {
- setNamespaces(null);
- }
- setUpProgressBar("Getting BioMOBY details for " + activity.getConfiguration().getServiceName() + " ...");
- // start our search
- getSemanticServiceTree();
- }
-
-
- }
-
- /**
- * @param central
- */
- private void getSemanticServiceTree() {
- Central central = activity.getCentral();
- MobyDataType object = activity.getMobyObject();
- MobyService template = new MobyService("dummy");
-
- // strip the lsid portion of the name
- String name = object.getName();
- if (name.indexOf(":") > 0) {
- name = name.substring(name.lastIndexOf(":") + 1);
- }
- // initialize a data object to pass into the service template
- Registry mRegistry = new Registry(central.getRegistryEndpoint(),central.getRegistryEndpoint(),"http://domain.com/MOBY/Central");
- MobyDataObject data = new MobyDataObject("", mRegistry);
- data.setDataType(new MobyDataType(name));
- data.setXmlMode(MobyDataInstance.CENTRAL_XML_MODE);
- if (action.namespaces != null)
- data.setNamespaces(action.namespaces);
- // create the nodes for the tree
- MutableTreeNode parent = new DefaultMutableTreeNode(name);
- MutableTreeNode inputNode = new DefaultMutableTreeNode("Feeds into");
- MutableTreeNode outputNode = new DefaultMutableTreeNode("Produced by");
-
- // what services does this object feed into?
- template.setInputs(new MobyData[] { data });
- template.setCategory("");
- MobyService[] services = null;
- Set<MobyService> theServices = new TreeSet<MobyService>();
- try {
- services = central.findService(template, null, true, action.searchParentTypes);
-
- theServices.addAll(Arrays.asList(services));
- MobyDataObjectSet set = new MobyDataObjectSet("");
- set.add(data);
- template.setInputs(null);
- template.setInputs(new MobyData[]{set});
- services = central.findService(template, null, true, action.searchParentTypes);
- theServices.addAll(Arrays.asList(services));
- } catch (MobyException e) {
- panel.add(new JTree(new String[] { "Error finding services",
- "TODO: create a better Error" }), BorderLayout.CENTER);
- panel.updateUI();
- return;
- }
- createTreeNodes(inputNode, theServices.toArray(new MobyService[]{}));
- if (inputNode.getChildCount() == 0)
- inputNode.insert(new DefaultMutableTreeNode(
- "Object Doesn't Currently Feed Into Any Services"), 0);
-
- // what services return this object?
- template = null;
- template = new MobyService("dummy");
- template.setCategory("");
- template.setOutputs(new MobyData[] { data });
- services = null;
- theServices = new TreeSet<MobyService>();
- try {
- services = central.findService(template, null, true, action.searchParentTypes);
- theServices.addAll(Arrays.asList(services));
- MobyDataObjectSet set = new MobyDataObjectSet("");
- set.add(data);
- template.setOutputs(null);
- template.setOutputs(new MobyData[]{set});
- services = central.findService(template, null, true, action.searchParentTypes);
- theServices.addAll(Arrays.asList(services));
- } catch (MobyException e) {
- panel.add(new JTree(new String[] { "Error finding services",
- "TODO: create a better Error" }), BorderLayout.CENTER);
- panel.updateUI();
- return;
- }
- createTreeNodes(outputNode, theServices.toArray(new MobyService[]{}));
- if (outputNode.getChildCount() == 0)
- outputNode.insert(new DefaultMutableTreeNode(
- "Object Isn't Produced By Any Services"), 0);
- // what kind of object is this?
-
- // set up the nodes
- parent.insert(inputNode, 0);
- parent.insert(outputNode, 1);
-
- // finally return a tree describing the object
- final JTree tree = new JTree(parent);
- tree.setCellRenderer(new BioMobyObjectTreeCustomRenderer());
- ToolTipManager.sharedInstance().registerComponent(tree);
- tree.addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent me) {
- }
-
- public void mousePressed(MouseEvent me) {
- mouseReleased(me);
- }
-
- public void mouseReleased(MouseEvent me) {
- if (me.isPopupTrigger()) // right click, show popup menu
- {
- TreePath path = tree.getPathForLocation(me.getX(), me.getY());
- if (path == null)
- return;
- if (path.getPathCount() == 4) {
- if (path.getParentPath().getParentPath().getLastPathComponent()
- .toString().equals("Feeds into")) {
-
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
- .getLastSelectedPathComponent();
- if (node == null)
- return;
- final String selectedService = node.toString();
- // ensure that the last selected item is a
- // service!
- if (!selectedService.equals(path.getLastPathComponent().toString()))
- return;
- final String selectedAuthority = path.getParentPath()
- .getLastPathComponent().toString();
- final JPopupMenu menu = new JPopupMenu();
- // Create and add a menu item for adding to the
- // item
- // to the workflow
- JMenuItem item = new JMenuItem("Add service - " + selectedService
- + " to the workflow?");
- item
- .setIcon(MobyPanel.getIcon("/Add24.gif"));
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
-
- try {
- if (outputPort==null) {
- outputPort = activity.getOutputPorts().iterator().next();
- }
- Dataflow currentDataflow = fileManager.getCurrentDataflow();
- Edit<?> edit = new AddBiomobyConsumingServiceEdit(
- currentDataflow, activity,
- selectedService,selectedAuthority,outputPort, editManager.getEdits());
- editManager.doDataflowEdit(
- currentDataflow, edit);
-
- } catch (Exception e) {
- logger.error("Could not perform action", e);
- }
- }
- });
- // Create and add a menu item for service
- // details
- JMenuItem details = new JMenuItem("Find out about "
- + selectedService);
- details
- .setIcon(MobyPanel.getIcon("/Information24.gif"));
- details.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
- // Create a frame
- Frame frame = MobyPanel.CreateFrame("A BioMoby Service Description");
- frame.setSize(getFrameSize());
- JPanel panel = new MobyPanel(selectedService,"A BioMoby Service Description",
- createServiceDescription(selectedService,
- selectedAuthority, activity.getConfiguration().getMobyEndpoint()));
- frame.add(panel);
- frame.pack();
- frame.setVisible(true);
- }
-
- @SuppressWarnings("unchecked")
- private String createServiceDescription(String selectedService,
- String selectedAuthority, String endpoint) {
- StringBuffer sb = new StringBuffer();
- String newline = System.getProperty("line.separator");
- MobyService service = new MobyService(selectedService);
- try {
- Central central = new CentralImpl(endpoint);
- service.setAuthority(selectedAuthority);
- service.setCategory("");
- MobyService[] services = central.findService(service);
- if (services == null || services.length != 1) {
- return "Couldn't retrieve a description on the BioMoby service '"
- + selectedService + "'";
- }
- service = services[0];
-
- } catch (MobyException e) {
- logger.error("Could not retrieve a description on the BioMoby service "
- + selectedService, e);
- return "Couldn't retrieve a description on the BioMoby service '"
- + selectedService + "'";
- }
- sb.append("Service Contact: " + newline + "\t"
- + service.getEmailContact() + newline);
- sb.append("Service Category: " + newline + "\t"
- + service.getCategory() + newline);
- sb.append("Service Authority: " + newline + "\t"
- + service.getAuthority() + newline);
- sb.append("Service Type: " + newline + "\t"
- + service.getType() + newline);
- sb.append("Service Description: " + newline + "\t"
- + service.getDescription() + newline);
- sb.append("Location of Service: " + newline + "\t"
- + service.getURL() + newline);
- sb.append("Service Signature RDF Document is located at: "
- + newline + "\t" + service.getSignatureURL()
- + newline);
- MobyData[] data = service.getPrimaryInputs();
- Vector primaryDataSimples = new Vector();
- Vector primaryDataSets = new Vector();
- for (int x = 0; x < data.length; x++) {
- if (data[x] instanceof MobyPrimaryDataSimple)
- primaryDataSimples.add(data[x]);
- else
- primaryDataSets.add(data[x]);
- }
- // describe inputs simple then
- // collections
- sb.append("Inputs:" + newline);
- if (primaryDataSimples.size() == 0) {
- sb.append("\t\tNo Simple input datatypes consumed."
- + newline);
- } else {
- Iterator it = primaryDataSimples.iterator();
- sb
- .append("\t\tService consumes the following Simple(s):"
- + newline);
- while (it.hasNext()) {
- MobyPrimaryDataSimple simple = (MobyPrimaryDataSimple) it
- .next();
- MobyNamespace[] namespaces = simple.getNamespaces();
- sb.append("\t\tData type: "
- + simple.getDataType().getName() + newline);
- sb.append("\t\t\tArticle name: " + simple.getName()
- + newline);
- if (namespaces.length == 0) {
- sb.append("\t\t\tValid Namespaces: ANY"
- + newline);
- } else {
- sb.append("\t\t\tValid Namespaces: ");
- for (int x = 0; x < namespaces.length; x++)
- sb.append(namespaces[x].getName() + " ");
- sb.append(newline);
- }
- }
- }
- if (primaryDataSets.size() == 0) {
- sb.append(newline
- + "\t\tNo Collection input datatypes consumed."
- + newline);
- } else {
- Iterator it = primaryDataSets.iterator();
- sb
- .append(newline
- + "\t\tService consumes the following collection(s) of datatypes:"
- + newline);
- while (it.hasNext()) {
- MobyPrimaryDataSet set = (MobyPrimaryDataSet) it
- .next();
- MobyPrimaryDataSimple simple = null;
- sb.append("\t\tCollection Name:" + set.getName()
- + newline);
- MobyPrimaryDataSimple[] simples = set.getElements();
- for (int i = 0; i < simples.length; i++) {
- simple = simples[i];
- MobyNamespace[] namespaces = simple
- .getNamespaces();
- // iterate through set and
- // do
- // the following
- sb.append("\t\tData type: "
- + simple.getDataType().getName()
- + newline);
- sb.append("\t\t\tArticle name: "
- + simple.getName() + newline);
- if (namespaces.length == 0) {
- sb.append("\t\t\tValid Namespaces: ANY"
- + newline);
- } else {
- sb.append("\t\t\tValid Namespaces: ");
- for (int x = 0; x < namespaces.length; x++)
- sb
- .append(namespaces[x].getName()
- + " ");
- sb.append(newline);
- }
- }
- }
- }
- // describe secondary inputs
- // describe outputs simple then
- // collections
- data = service.getPrimaryOutputs();
- primaryDataSimples = new Vector();
- primaryDataSets = new Vector();
- for (int x = 0; x < data.length; x++) {
- if (data[x] instanceof MobyPrimaryDataSimple)
- primaryDataSimples.add(data[x]);
- else
- primaryDataSets.add(data[x]);
- }
- sb.append("Outputs:" + newline);
- if (primaryDataSimples.size() == 0) {
- sb.append("\t\tNo Simple output datatypes produced."
- + newline);
- } else {
- Iterator it = primaryDataSimples.iterator();
- sb
- .append("\t\tService produces the following Simple(s):"
- + newline);
- while (it.hasNext()) {
- MobyPrimaryDataSimple simple = (MobyPrimaryDataSimple) it
- .next();
- MobyNamespace[] namespaces = simple.getNamespaces();
- sb.append("\t\tData type: "
- + simple.getDataType().getName() + newline);
- sb.append("\t\t\tArticle name: " + simple.getName()
- + newline);
- if (namespaces.length == 0) {
- sb.append("\t\t\tValid Namespaces: ANY"
- + newline);
- } else {
- sb.append("\t\t\tValid Namespaces: ");
- for (int x = 0; x < namespaces.length; x++)
- sb.append(namespaces[x].getName() + " ");
- sb.append(newline);
- }
- }
- }
- if (primaryDataSets.size() == 0) {
- sb
- .append(newline
- + "\t\tNo Collection output datatypes produced."
- + newline);
- } else {
- Iterator it = primaryDataSets.iterator();
- sb
- .append(newline
- + "\t\tService produces the following collection(s) of datatypes:"
- + newline);
- while (it.hasNext()) {
- MobyPrimaryDataSet set = (MobyPrimaryDataSet) it
- .next();
- MobyPrimaryDataSimple simple = null;
- sb.append("\t\tCollection Name:" + set.getName()
- + newline);
- MobyPrimaryDataSimple[] simples = set.getElements();
- for (int i = 0; i < simples.length; i++) {
- simple = simples[i];
- MobyNamespace[] namespaces = simple
- .getNamespaces();
- // iterate through set and
- // do
- // the following
- sb.append("\t\tData type: "
- + simple.getDataType().getName()
- + newline);
- sb.append("\t\t\tArticle name: "
- + simple.getName() + newline);
- if (namespaces.length == 0) {
- sb.append("\t\t\tValid Namespaces: ANY"
- + newline);
- } else {
- sb.append("\t\t\tValid Namespaces: ");
- for (int x = 0; x < namespaces.length; x++)
- sb
- .append(namespaces[x].getName()
- + " ");
- sb.append(newline);
- }
- }
- }
- }
- sb.append((service.isAuthoritative()) ? newline
- + "The service belongs to this author." + newline
- : newline
- + "The service was wrapped by it's author."
- + newline);
- return sb.toString();
- }
- });
- // add the components to the menus
- menu.add(new JLabel("Add to workflow ... ", JLabel.CENTER));
- menu.add(new JSeparator());
- menu.add(item);
- menu.add(new JSeparator());
- menu.add(new JLabel("Service Details ... ", JLabel.CENTER));
- menu.add(new JSeparator());
- menu.add(details);
- // show the window
- menu.show(me.getComponent(), me.getX(), me.getY());
- }
- }
- }
- }
-
- public void mouseEntered(MouseEvent me) {
- }
-
- public void mouseExited(MouseEvent me) {
- }
- });
- tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
- panel.add(new JScrollPane(tree), BorderLayout.CENTER);
- takeDownProgressBar();
- }
-
- private void createNamespaceList(MobyNamespace[] fullNamespaces) {
- // sort the namespaces alphabetically
- DefaultMutableTreeNode root = new DefaultMutableTreeNode("ANY");
- // assuming that they increment by one ...
- TreeMap<String, TreeSet<String>> sorted = new TreeMap<String, TreeSet<String>>();
- for (MobyNamespace n : fullNamespaces) {
- String name = n.getName();
- String key = name.toUpperCase().substring(0, 1);
- if (sorted.get(key) == null) {
- sorted.put(key, new TreeSet<String>());
- }
- sorted.get(key).add(name);
- }
- for (String o : sorted.keySet()) {
- if (sorted.get(o) == null)
- continue;
- TreeSet<String> set = sorted.get(o);
- String first = set.first().toUpperCase().charAt(0) + "";
- DefaultMutableTreeNode node = new DefaultMutableTreeNode(first);
- for (String s : set) {
- node.add(new DefaultMutableTreeNode(s));
- }
- root.add(node);
- }
- namespaceList = new JTree(root);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.embl.ebi.escience.scuflui.processoractions.AbstractProcessorAction#getComponent(org.embl.ebi.escience.scufl.Processor)
- */
- public JComponent getComponent(BiomobyObjectActivity activity) {
-
- // this was done so that for longer requests, something is shown visually and the user then wont think that nothing happened.
- Worker worker = new Worker(activity, this);
- worker.start();
- return worker.getPanel();
- }
-
- /*
- * method that processes the services returned by findService and adds them
- * to the TreeNode parentNode, sorted by authority
- */
- @SuppressWarnings("unchecked")
- private void createTreeNodes(MutableTreeNode parentNode, MobyService[] services) {
- HashMap inputHash;
- inputHash = new HashMap();
- for (int x = 0; x < services.length; x++) {
- DefaultMutableTreeNode authorityNode = null;
- if (!inputHash.containsKey(services[x].getAuthority())) {
- authorityNode = new DefaultMutableTreeNode(services[x].getAuthority());
- } else {
- authorityNode = (DefaultMutableTreeNode) inputHash.get(services[x].getAuthority());
- }
- MobyServiceTreeNode serv = new MobyServiceTreeNode(services[x].getName(), services[x]
- .getDescription());
- MutableTreeNode temp = new DefaultMutableTreeNode(serv);
- DefaultMutableTreeNode objects = new DefaultMutableTreeNode("Produces");
- // add to this node the MobyObjectTreeNodes that it produces!
- MobyData[] outputs = services[x].getPrimaryOutputs();
- for (int i = 0; i < outputs.length; i++) {
- if (outputs[i] instanceof MobyPrimaryDataSimple) {
- MobyPrimaryDataSimple simple = (MobyPrimaryDataSimple) outputs[i];
- StringBuffer sb = new StringBuffer("Namespaces used by this object: ");
- MobyNamespace[] namespaces = simple.getNamespaces();
- for (int j = 0; j < namespaces.length; j++) {
- sb.append(namespaces[j].getName() + " ");
- }
- if (namespaces.length == 0)
- sb.append("ANY ");
- MobyObjectTreeNode mobyObjectTreeNode = new MobyObjectTreeNode(simple
- .getDataType().getName()
- + "('" + simple.getName() + "')", sb.toString());
- objects.insert(new DefaultMutableTreeNode(mobyObjectTreeNode), objects
- .getChildCount());
- } else {
- // we have a collection
- MobyPrimaryDataSet collection = (MobyPrimaryDataSet) outputs[i];
- DefaultMutableTreeNode collectionNode = new DefaultMutableTreeNode(
- "Collection('" + collection.getName() + "')");
- objects.insert(collectionNode, objects.getChildCount());
- MobyPrimaryDataSimple[] simples = collection.getElements();
- for (int j = 0; j < simples.length; j++) {
- MobyPrimaryDataSimple simple = simples[j];
- StringBuffer sb = new StringBuffer("Namespaces used by this object: ");
- MobyNamespace[] namespaces = simple.getNamespaces();
- for (int k = 0; k < namespaces.length; k++) {
- sb.append(namespaces[k].getName() + " ");
- }
- if (namespaces.length == 0)
- sb.append("ANY ");
- MobyObjectTreeNode mobyObjectTreeNode = new MobyObjectTreeNode(simple
- .getDataType().getName()
- + "('" + simple.getName() + "')", sb.toString());
- collectionNode.insert(new DefaultMutableTreeNode(mobyObjectTreeNode),
- collectionNode.getChildCount());
- }
-
- }
- }
-
- temp.insert(objects, temp.getChildCount());
-
- authorityNode.insert(temp, authorityNode.getChildCount());
- inputHash.put(services[x].getAuthority(), authorityNode);
-
- }
- Set set = inputHash.keySet();
- SortedSet sortedset = new TreeSet(set);
- for (Iterator it = sortedset.iterator(); it.hasNext();) {
- parentNode.insert((DefaultMutableTreeNode) inputHash.get((String) it.next()),
- parentNode.getChildCount());
- }
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.embl.ebi.escience.scuflui.processoractions.ProcessorActionSPI#getDescription()
- */
- public String getDescription() {
- return "Moby Object Details";
- }
-
- /*
- *
- */
- public ImageIcon getIcon() {
- return MobyPanel.getIcon("/moby_small.gif");
- }
-
- /**
- * returns the frame size as a dimension for the content pane housing this
- * action
- */
- public Dimension getFrameSize() {
- return new Dimension(450, 450);
- }
-
- public void setNamespaces(MobyNamespace[] namespaces) {
- if (namespaces != null && namespaces.length == 0)
- this.namespaces = null;
- else
- this.namespaces = namespaces;
- }
- public MobyNamespace[] getNamespaces() {
- return this.namespaces == null ? new MobyNamespace[]{} : this.namespaces;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyScavengerDialog.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyScavengerDialog.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyScavengerDialog.java
deleted file mode 100644
index 4419bf9..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyScavengerDialog.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- ******************************************************************************/
-/*
- * This file is a component of the Taverna project,
- * and is licensed under the GNU LGPL.
- * Copyright Edward Kawas, The BioMoby Project
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.JComboBox;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import org.biomoby.registry.meta.Registries;
-import org.biomoby.registry.meta.RegistriesList;
-import org.biomoby.shared.MobyException;
-
-import net.sf.taverna.t2.lang.ui.ShadedLabel;
-
-/**
- * a dialog for helping create scavengers for BioMoby registries that are not
- * the default registry.
- *
- */
-public class BiomobyScavengerDialog extends JPanel {
-
- private static final String CUSTOM = "Custom";
- private static final long serialVersionUID = -57047613557546674L;
- private JTextField registryEndpoint = new JTextField(
- "http://moby.ucalgary.ca/moby/MOBY-Central.pl");
- private JTextField registryURI = new JTextField(
- "http://moby.ucalgary.ca/MOBY/Central");
-
- /**
- * Default constructor.
- *
- */
- /**
- * Default constructor.
- *
- */
- public BiomobyScavengerDialog() {
- super();
- GridLayout layout = new GridLayout(5, 2);
- setLayout(layout);
-
- registryEndpoint.setEnabled(false);
- registryURI.setEnabled(false);
-
- // a combo box showing known registries
- final Registries regs = RegistriesList.getInstance();
- List<String> choices = new ArrayList<String>(Arrays.asList(regs.list()));
- choices.add(CUSTOM);
-
- JComboBox regList = new JComboBox(choices.toArray());
- regList.setToolTipText("A selection will fill text fields below");
- regList.setSelectedItem(Registries.DEFAULT_REGISTRY_SYNONYM);
- regList.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- String contents = (String) ((JComboBox) e.getSource())
- .getSelectedItem();
-
- if (contents.equals(CUSTOM)) {
- registryEndpoint.setEnabled(true);
- registryURI.setEnabled(true);
- return;
- } else {
- registryEndpoint.setEnabled(false);
- registryURI.setEnabled(false);
- }
- org.biomoby.registry.meta.Registry theReg = null;
- try {
- theReg = regs.get(contents);
- } catch (MobyException ee) {
- try {
- theReg = regs.get(null);
- } catch (MobyException ee2) {
-
- }
- }
- if (theReg != null) {
- registryEndpoint.setText(theReg.getEndpoint());
- registryURI.setText(theReg.getNamespace());
-
- }
- }
- });
- add(new ShadedLabel("Choose a registry from the list: ",
- ShadedLabel.BLUE, true));
- add(regList);
- add(new ShadedLabel("Or select '" + CUSTOM + "' to enter your own below,", ShadedLabel.BLUE, true));
- add(new ShadedLabel("", ShadedLabel.BLUE, true));
- add(new ShadedLabel(
- "Location (URL) of your BioMoby central registry: ",
- ShadedLabel.BLUE, true));
- registryEndpoint
- .setToolTipText("BioMoby Services will be retrieved from the endpoint that you specify here!");
- add(registryEndpoint);
- add(new ShadedLabel(
- "Namespace (URI) of your BioMoby central registry: ",
- ShadedLabel.BLUE, true));
- registryURI
- .setToolTipText("BioMoby Services will be retrieved from the endpoint/URI that you specify here!");
- add(registryURI);
- // add(Box.createHorizontalGlue());add(Box.createHorizontalGlue());
- setPreferredSize(this.getPreferredSize());
- setMinimumSize(this.getPreferredSize());
- setMaximumSize(this.getPreferredSize());
-
- }
-
- /**
- *
- * @return the string representation of the BioMoby Registry endpoint
- */
- public String getRegistryEndpoint() {
- return registryEndpoint.getText();
- }
-
- /**
- *
- * @return the string representation of the BioMoby Registry endpoint
- */
- public String getRegistryURI() {
- return registryURI.getText();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyObjectDetailsAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyObjectDetailsAction.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyObjectDetailsAction.java
deleted file mode 100644
index 803fde3..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyObjectDetailsAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JDialog;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivity;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-
-/**
- * @author Stuart Owen
- *
- */
-@SuppressWarnings("serial")
-public class MobyObjectDetailsAction extends AbstractAction {
-
- private final BiomobyObjectActivity activity;
- private final Frame owner;
- private EditManager editManager;
-
- private static final String MOBY_OBJECT_DETAILS_ACTION = "Datatype registry query";
- private final FileManager fileManager;
-
- public MobyObjectDetailsAction(BiomobyObjectActivity activity, Frame owner, EditManager editManager, FileManager fileManager) {
- this.activity = activity;
- this.owner = owner;
- this.editManager = editManager;
- this.fileManager = fileManager;
- putValue(NAME, MOBY_OBJECT_DETAILS_ACTION);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent e) {
- BiomobyObjectActionHelper helper = new BiomobyObjectActionHelper(editManager, fileManager);
- Dimension size = helper.getFrameSize();
-
- Component component = helper.getComponent(activity);
-
- final JDialog dialog = new HelpEnabledDialog(owner, helper.getDescription(), false, null);
- dialog.getContentPane().add(component);
- dialog.pack();
- // dialog.setTitle(helper.getDescription());
- dialog.setSize(size);
- // dialog.setModal(false);
- dialog.setVisible(true);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyObjectTreeNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyObjectTreeNode.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyObjectTreeNode.java
deleted file mode 100644
index f58efc6..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyObjectTreeNode.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file is a component of the Taverna project,
- * and is licensed under the GNU LGPL.
- * Copyright Edward Kawas, The BioMoby Project
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import org.biomoby.shared.MobyNamespace;
-
-public class MobyObjectTreeNode {
-
- // name of the object == node name
- private String name = "";
-
- // description of object == tool tip text
- private String description = "";
-
- private MobyNamespace[] ns = null;
- /**
- *
- * @param name - the name of the Moby Object
- * @param description - the description of the Moby Service
- */
- public MobyObjectTreeNode(String name, String description) {
- this.name = name;
- this.description = description;
- }
- /*
- * over-ride the toString method in order to print node values
- * that make sense.
- */
- public String toString() {
- return name;
- }
-
- public void setNamespaces(MobyNamespace[] namespaces) {
- if (namespaces != null && namespaces.length == 0)
- this.ns = null;
- else
- this.ns = namespaces;
- }
-
- public MobyNamespace[] getNamespaces() {
- return this.ns;
- }
-
- public String getDescription() {
- return this.description;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyPanel.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyPanel.java
deleted file mode 100644
index a2e0a70..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyPanel.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Created on Sep 9, 2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.BorderLayout;
-import java.awt.Frame;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.ImageIcon;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import net.sf.taverna.t2.lang.ui.DialogTextArea;
-
-/**
- * @author Eddie Kawas
- *
- *
- */
-public class MobyPanel extends JPanel {
-
-
- private static final long serialVersionUID = 1L;
- private DialogTextArea textArea = null;
- private String text = "";
- private String name = "";
- private JLabel jLabel = new JLabel();
-
- /**
- * This is the default constructor
- */
- public MobyPanel(String label, String name, String text) {
- super(new BorderLayout());
- jLabel.setText(label);
- this.text = text;
- this.name = name;
- initialize();
- }
-
- public MobyPanel(String label) {
- super(new BorderLayout());
- jLabel.setText(label);
- initialize();
- }
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(450, 450);
- jLabel.setHorizontalAlignment(JLabel.CENTER);
- add(jLabel, BorderLayout.NORTH);
- add(getTextArea(), BorderLayout.CENTER);
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return DialogTextArea
- */
- private DialogTextArea getTextArea() {
- if (textArea == null) {
- textArea = new DialogTextArea();
- }
- textArea.setLineWrap(true);
- textArea.setWrapStyleWord(true);
- textArea.setText(this.text);
- textArea.setEditable(false);
- textArea.setEnabled(true);
- textArea.setAutoscrolls(true);
- textArea.setCaretPosition(0);
- return textArea;
- }
-
- public void setText(String text) {
- this.text = text;
- if (textArea == null) {
- textArea = new DialogTextArea(this.text);
- }
- textArea.setText(text);
- }
-
- /* (non-Javadoc)
- * @see org.embl.ebi.escience.scuflui.ScuflUIComponent#getIcon()
- */
- public ImageIcon getIcon() {
- return new ImageIcon(MobyPanel.class.getResource("/moby_small.png"));
- }
-
- /**
- *
- * @param icon a relative path to an icon to get
- * @return the ImageIcon at icon
- */
- public static ImageIcon getIcon(String icon) {
- return new ImageIcon(MobyPanel.class.getResource(icon));
- }
-
- public String getName(){
- if (name==null) return "";
- else return name;
- }
-
- public void onDisplay() {
- // TODO Auto-generated method stub
-
- }
-
- public void onDispose() {
- // TODO Auto-generated method stub
-
- }
-
- public static Frame CreateFrame(String title) {
- // Create a frame
- Frame frame = new Frame(title);
- // Add a listener for the close event
- frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent evt) {
- Frame frame = (Frame)evt.getSource();
- // Hide the frame
- frame.setVisible(false);
- // If the frame is no longer needed, call dispose
- frame.dispose();
- }
- });
- return frame;
- }
- }
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyParserAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyParserAction.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyParserAction.java
deleted file mode 100644
index 865c1f1..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyParserAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.Component;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JDialog;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-
-/**
- * @author Stuart Owen
- *
- */
-@SuppressWarnings("serial")
-public class MobyParserAction extends AbstractAction {
-
- private final BiomobyActivity activity;
- private final Frame owner;
- private EditManager editManager;
- private final FileManager fileManager;
-
- public MobyParserAction(BiomobyActivity activity, Frame owner, EditManager editManager, FileManager fileManager) {
- this.activity = activity;
- this.owner = owner;
- this.editManager = editManager;
- this.fileManager = fileManager;
- putValue(NAME, "Add Biomoby parser");
-
- }
- public void actionPerformed(ActionEvent e) {
- AddParserActionHelper helper = new AddParserActionHelper(editManager, fileManager);
- Component component = helper.getComponent(activity);
-
- final JDialog dialog = new HelpEnabledDialog(owner, helper.getDescription(), false, null);
- dialog.getContentPane().add(component);
- dialog.pack();
-// dialog.setSize(helper.getFrameSize());
- dialog.setTitle(helper.getDescription());
-// dialog.setModal(false);
- dialog.setVisible(true);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyServiceDetailsAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyServiceDetailsAction.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyServiceDetailsAction.java
deleted file mode 100644
index 5000986..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyServiceDetailsAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JDialog;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-
-/**
- * @author Stuart Owen
- *
- */
-@SuppressWarnings("serial")
-public class MobyServiceDetailsAction extends AbstractAction {
-
- private final BiomobyActivity activity;
- private final Frame owner;
- private EditManager editManager;
-
- private static final String MOBY_SERVICE_DETAILS_ACTION = "Browse Biomoby service details";
- private final FileManager fileManager;
- public MobyServiceDetailsAction(BiomobyActivity activity, Frame owner, EditManager editManager, FileManager fileManager) {
- this.activity = activity;
- this.owner = owner;
- this.editManager = editManager;
- this.fileManager = fileManager;
- putValue(NAME, MOBY_SERVICE_DETAILS_ACTION);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent e) {
-
- BiomobyActionHelper helper = new BiomobyActionHelper(editManager, fileManager);
- Dimension size = helper.getFrameSize();
-
- Component component = helper.getComponent(activity);
- final JDialog dialog = new HelpEnabledDialog(owner, helper.getDescription(), false, null);
-
- dialog.getContentPane().add(component);
- dialog.pack();
-// dialog.setTitle(helper.getDescription());
- dialog.setSize(size);
-// dialog.setModal(false);
- dialog.setVisible(true);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyServiceTreeNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyServiceTreeNode.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyServiceTreeNode.java
deleted file mode 100644
index c957a1f..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/MobyServiceTreeNode.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is a component of the Taverna project,
- * and is licensed under the GNU LGPL.
- * Copyright Edward Kawas, The BioMoby Project
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-import java.util.ArrayList;
-
-public class MobyServiceTreeNode {
-
- // name of the service == node name
- private String name = "";
-
- // list of objects that service produces
- @SuppressWarnings("unused")
- private ArrayList<MobyObjectTreeNode> mobyObjectTreeNodes = null;
-
- // description of object == tool tip text
- private String description = "";
-
-
- /**
- *
- * @param name - the name of the Moby Service
- * @param description - the description of the Moby Service
- */
- public MobyServiceTreeNode(String name, String description) {
- this.name = name;
- this.description = description;
- }
- /*
- * over-ride the toString method in order to print node values
- * that make sense.
- */
- public String toString() {
- return name;
- }
-
- public String getDescription() {
- return this.description;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/PopupThread.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/PopupThread.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/PopupThread.java
deleted file mode 100644
index 0c8b9fc..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/PopupThread.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.Component;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivity;
-
-
-public class PopupThread extends Thread {
-
- Object object = null;
-
- BiomobyObjectActivity objectActivity = null;
-
- BiomobyObjectActionHelper objectAction = null;
-
- boolean done = false;
-
- PopupThread(BiomobyObjectActivity bop, BiomobyObjectActionHelper boa) {
- super("Biomoby popup");
- this.objectAction = boa;
- this.objectActivity = bop;
- setDaemon(true);
- }
-
- public void run() {
- object = objectAction.getComponent(objectActivity);
- this.done = true;
- }
-
- // call after you check if done!
- public Component getComponent() {
- return (Component) object;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/SimpleActionFrame.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/SimpleActionFrame.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/SimpleActionFrame.java
deleted file mode 100644
index a85b50b..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/SimpleActionFrame.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * This file is a component of the Taverna project,
- * and is licensed under the GNU LGPL.
- * Copyright Edward Kawas, The BioMoby Project
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-
-import javax.swing.JPanel;
-
-
-/**
- * This class contains some methods that are useful in creating a consistent JPanel
- * for displaying information or actions for biomoby services and datatypes.
- *
- * @author Edward Kawas
- * @author Stuart Owen = initial port from T1 to T2
- *
- */
-public class SimpleActionFrame extends JPanel {
-
- private static final long serialVersionUID = -6611234116434482238L;
-
-
- private String name = "";
- public SimpleActionFrame(Component c, String name) {
- super(new BorderLayout());
- add(c, BorderLayout.CENTER);
-
- this.name = name;
- }
-
-
-
- public String getName() {
- return name;
- }
-
- public void onDisplay() {
-
- }
-
-
- }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/datatypedescriptions/BiomobyDatatypeDescription.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/datatypedescriptions/BiomobyDatatypeDescription.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/datatypedescriptions/BiomobyDatatypeDescription.java
deleted file mode 100644
index 35df9b8..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/datatypedescriptions/BiomobyDatatypeDescription.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package net.sf.taverna.t2.activities.biomoby.datatypedescriptions;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivity;
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivityConfigurationBean;
-import net.sf.taverna.t2.activities.biomoby.query.BiomobyObjectActivityIcon;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-public class BiomobyDatatypeDescription extends
- ServiceDescription<BiomobyObjectActivityConfigurationBean> {
-
- private String authorityName;
- private String emailContact;
- private String datatypeName;
- private URI lsid;
- private String parent;
- private String[] lineage;
-
- private URI endpoint;
- private URI namespace;
-
- @Override
- public Class<? extends Activity<BiomobyObjectActivityConfigurationBean>> getActivityClass() {
- return BiomobyObjectActivity.class;
- }
-
- @Override
- public BiomobyObjectActivityConfigurationBean getActivityConfiguration() {
- BiomobyObjectActivityConfigurationBean bean = new BiomobyObjectActivityConfigurationBean();
- bean.setAuthorityName(getAuthorityName());
- bean.setServiceName(getDatatypeName());
- bean.setMobyEndpoint(getEndpoint().toASCIIString());
- return bean;
- }
-
- public String getAuthorityName() {
- return authorityName;
- }
-
- public void setAuthorityName(String authorityName) {
- this.authorityName = authorityName;
- }
-
- public String getEmailContact() {
- return emailContact;
- }
-
- public void setEmailContact(String emailContact) {
- this.emailContact = emailContact;
- }
-
- public String getDatatypeName() {
- return datatypeName;
- }
-
- public void setDatatypeName(String datatypeName) {
- this.datatypeName = datatypeName;
- }
-
- public URI getLsid() {
- return lsid;
- }
-
- public void setLsid(URI lsid) {
- this.lsid = lsid;
- }
-
- public String getParent() {
- return parent;
- }
-
- public void setParent(String parent) {
- this.parent = parent;
- }
-
- public URI getEndpoint() {
- return endpoint;
- }
-
- public void setEndpoint(URI endpoint) {
- this.endpoint = endpoint;
- }
-
- public URI getNamespace() {
- return namespace;
- }
-
- public void setNamespace(URI namespace) {
- this.namespace = namespace;
- }
-
- public String[] getLineage() {
- return lineage;
- }
-
- public void setLineage(String[] lineage) {
- this.lineage = lineage;
- }
-
- @Override
- public String getName() {
- return getDatatypeName();
- }
-
- @Override
- protected List<Object> getIdentifyingData() {
- return Arrays.<Object> asList(getNamespace(), getEndpoint(), getAuthorityName(),
- getDatatypeName());
- }
-
- @Override
- public List<String> getPath() {
- ArrayList<String> list = new ArrayList<String>();
- list.add("Biomoby @ " + getEndpoint());
- list.add("MOBY Objects");
- list.addAll(Arrays.asList(getLineage()));
- return list;
- }
-
- @Override
- public Icon getIcon() {
- return new BiomobyObjectActivityIcon().getIcon(new BiomobyObjectActivity());
- }
-
- @Override
- public String toString() {
- return getName();
- }
-
- // public Edit getInsertionEdit(Dataflow dataflow, Processor p, Activity a) {
- // if (a instanceof BiomobyObjectActivity) {
- // return new AddUpstreamObjectEdit(dataflow, p, (BiomobyObjectActivity) a);
- // }
- // return null;
- // }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyCollectionDataTypeEdit.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyCollectionDataTypeEdit.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyCollectionDataTypeEdit.java
deleted file mode 100644
index 8e02195..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyCollectionDataTypeEdit.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- */
-package net.sf.taverna.t2.activities.biomoby.edits;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edits;
-
-/**
- * @author Stuart Owen
- *
- */
-public class AddBiomobyCollectionDataTypeEdit extends
- AddBiomobyDataTypeEdit {
-
- private final String theCollectionName;
-
- /**
- * @param dataflow
- * @param activity
- * @param objectName
- */
- public AddBiomobyCollectionDataTypeEdit(Dataflow dataflow,
- BiomobyActivity activity, String objectName, String theCollectionName, Edits edits) {
- super(dataflow, activity, objectName, edits);
- this.theCollectionName = theCollectionName;
- }
-
- @Override
- protected String determineInputPortName(String defaultName,String objectName) {
- return defaultName
- + "(Collection - '"
- + (theCollectionName.equals("") ? "MobyCollection"
- : theCollectionName)
- + "')";
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyConsumingServiceEdit.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyConsumingServiceEdit.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyConsumingServiceEdit.java
deleted file mode 100644
index e13c208..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyConsumingServiceEdit.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/**
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- */
-package net.sf.taverna.t2.activities.biomoby.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.biomoby.registry.meta.Registry;
-import org.biomoby.shared.MobyDataType;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivityConfigurationBean;
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivity;
-import net.sf.taverna.t2.workflowmodel.CompoundEdit;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.InputPort;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.impl.AbstractDataflowEdit;
-import net.sf.taverna.t2.workflowmodel.impl.DataflowImpl;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.t2.workflowmodel.utils.Tools;
-
-/**
- * @author Stuart Owen
- *
- */
-public class AddBiomobyConsumingServiceEdit extends AbstractDataflowEdit {
-
- private final BiomobyObjectActivity activity;
- private final String serviceName;
- private Edits edits;
- Edit<?> compoundEdit = null;
- Edit<?> linkEdit = null;
- private final String authority;
- private final OutputPort outputPort;
-
- /**
- * @param dataflow
- */
- public AddBiomobyConsumingServiceEdit(Dataflow dataflow,
- BiomobyObjectActivity activity, String serviceName,String authority,OutputPort outputPort, Edits edits) {
- super(dataflow);
-
- this.activity = activity;
- this.serviceName = serviceName;
- this.authority = authority;
- this.outputPort = outputPort;
- this.edits = edits;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * net.sf.taverna.t2.workflowmodel.impl.AbstractEdit#doEditAction(java.lang
- * .Object)
- */
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- String defaultName = serviceName;
- String name = Tools
- .uniqueProcessorName(defaultName, dataflow);
-
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
-
- net.sf.taverna.t2.workflowmodel.Processor sinkProcessor = edits
- .createProcessor(name);
-
- BiomobyActivityConfigurationBean bean = new BiomobyActivityConfigurationBean();
- bean.setAuthorityName(authority);
- bean.setServiceName(serviceName);
- bean.setMobyEndpoint(activity.getConfiguration().getMobyEndpoint());
- BiomobyActivity boActivity = new BiomobyActivity();
- editList.add(edits.getConfigureActivityEdit(boActivity, bean));
-
- editList.add(edits.getDefaultDispatchStackEdit(sinkProcessor));
-
- Edit<?> addActivityToProcessorEdit = edits.getAddActivityEdit(
- sinkProcessor, boActivity);
- editList.add(addActivityToProcessorEdit);
-
- editList.add(edits.getAddProcessorEdit(dataflow, sinkProcessor));
-
- compoundEdit = new CompoundEdit(editList);
- compoundEdit.doEdit();
-
- net.sf.taverna.t2.workflowmodel.Processor sourceProcessor = Tools.getProcessorsWithActivityOutputPort(dataflow, outputPort).iterator().next();
-
- List<Edit<?>> linkEditList = new ArrayList<Edit<?>>();
-
- EventForwardingOutputPort sourcePort = null;
- //FIXME: there is an assumption here that the processor will contain only 1 activity.
- if (outputPort != null) {
- sourcePort = getSourcePort(sourceProcessor, sourceProcessor.getActivityList().get(0), outputPort.getName(), linkEditList);
- }
- else {
- sourcePort = getSourcePort(sourceProcessor, sourceProcessor.getActivityList().get(0), sourceProcessor.getOutputPorts().get(0).getName(), linkEditList);
- }
- // get the input port that isnt called 'input'
- String inputPortName = "";
- for (ActivityInputPort aip : sinkProcessor.getActivityList().get(0).getInputPorts()) {
- if (!aip.getName().equalsIgnoreCase("input")) {
- // try to match the datatype to an input port
- String dtName = activity.getMobyObject().getName();
- String sinkDtname = aip.getName();
- if (sinkDtname.indexOf("(") > 0)
- sinkDtname = sinkDtname.substring(0, sinkDtname.indexOf("("));
- // are the datatype names exactly the same?
- if (dtName.equals(sinkDtname)) {
- inputPortName = aip.getName();
- break;
- }
- // check for the name in the datatypes lineage
- MobyDataType sinkDt = MobyDataType.getDataType(dtName,
- new Registry(
- activity.getCentral().getRegistryEndpoint(),
- activity.getCentral().getRegistryEndpoint(),
- activity.getCentral().getRegistryNamespace())
- );
- // check the lineage of the sinkdt for dtname
- for (MobyDataType lineage : sinkDt.getLineage()) {
- if (lineage.getName().equals(sinkDtname)) {
- inputPortName = aip.getName();
- break;
- }
- }
- // are we done?
- if (!inputPortName.trim().equals(""))
- break;
- }
- }
- // if inputPortName is not set, then just pick the first one
- if (inputPortName.trim().equals("")) {
- inputPortName = sinkProcessor.getActivityList().get(0).getInputPorts().iterator().next().getName();
- }
- EventHandlingInputPort sinkPort = getSinkPort(sinkProcessor, boActivity, inputPortName, linkEditList);
- if (sinkPort==null) {
- throw new EditException("No valid input called '"+inputPortName+"' found for Biomoby consuming service");
- }
- linkEditList.add(Tools
- .getCreateAndConnectDatalinkEdit(
- dataflow,
- sourcePort, sinkPort, edits));
- linkEdit = new CompoundEdit(linkEditList);
- linkEdit.doEdit();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * net.sf.taverna.t2.workflowmodel.impl.AbstractEdit#undoEditAction(java
- * .lang.Object)
- */
- @Override
- protected void undoEditAction(DataflowImpl subjectImpl) {
- if (linkEdit!=null && linkEdit.isApplied())
- linkEdit.undo();
- if (compoundEdit!=null && compoundEdit.isApplied())
- compoundEdit.undo();
- }
-
- private EventHandlingInputPort getSinkPort(
- net.sf.taverna.t2.workflowmodel.Processor processor,
- Activity<?> activity, String portName, List<Edit<?>> editList) {
- InputPort activityPort = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getActivityInputPort(activity, portName);
- // check if processor port exists
- EventHandlingInputPort input = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getProcessorInputPort(processor, activity, activityPort);
- if (input == null) {
- // port doesn't exist so create a processor port and map it
- ProcessorInputPort processorInputPort = edits
- .createProcessorInputPort(processor,
- activityPort.getName(), activityPort.getDepth());
- editList.add(edits.getAddProcessorInputPortEdit(processor,
- processorInputPort));
- editList.add(edits.getAddActivityInputPortMappingEdit(activity,
- activityPort.getName(), activityPort.getName()));
- input = processorInputPort;
- }
- return input;
- }
-
- private EventForwardingOutputPort getSourcePort(
- net.sf.taverna.t2.workflowmodel.Processor processor,
- Activity<?> activity, String portName, List<Edit<?>> editList) {
- OutputPort activityPort = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getActivityOutputPort(activity, portName);
- // check if processor port exists
- EventForwardingOutputPort output = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getProcessorOutputPort(processor, activity, activityPort);
- if (output == null) {
- // port doesn't exist so create a processor port and map it
- ProcessorOutputPort processorOutputPort = edits
- .createProcessorOutputPort(processor, activityPort
- .getName(), activityPort.getDepth(), activityPort
- .getGranularDepth());
- editList.add(edits.getAddProcessorOutputPortEdit(processor,
- processorOutputPort));
- editList.add(edits.getAddActivityOutputPortMappingEdit(activity,
- activityPort.getName(), activityPort.getName()));
- output = processorOutputPort;
- }
- return output;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyDataTypeEdit.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyDataTypeEdit.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyDataTypeEdit.java
deleted file mode 100644
index e13c264..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddBiomobyDataTypeEdit.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomoby.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivity;
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivityConfigurationBean;
-import net.sf.taverna.t2.workflowmodel.CompoundEdit;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.InputPort;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.impl.AbstractDataflowEdit;
-import net.sf.taverna.t2.workflowmodel.impl.DataflowImpl;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.utils.Tools;
-
-/**
- * @author Stuart Owen
- *
- */
-public class AddBiomobyDataTypeEdit extends AbstractDataflowEdit {
-
- private final BiomobyActivity activity;
- private Edits edits;
- private final String objectName;
-
- private Edit<?> compoundEdit = null;
- private Edit<?> linkEdit = null;
- private Edit<?> upstreamObjectEdit = null;
-
-
- public AddBiomobyDataTypeEdit(Dataflow dataflow,BiomobyActivity activity,String objectName, Edits edits) {
- super(dataflow);
- this.activity = activity;
- this.objectName = objectName;
- this.edits = edits;
-
- }
-
-
-
-
-
- /* (non-Javadoc)
- * @see net.sf.taverna.t2.workflowmodel.impl.AbstractDataflowEdit#doEditAction(net.sf.taverna.t2.workflowmodel.impl.DataflowImpl)
- */
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
-
-
- String defaultName = objectName;
- defaultName = defaultName.split("\\(")[0];
- String name = Tools.uniqueProcessorName(objectName, dataflow);
-
- BiomobyObjectActivityConfigurationBean configBean = new BiomobyObjectActivityConfigurationBean();
- configBean.setMobyEndpoint(activity
- .getConfiguration()
- .getMobyEndpoint());
- configBean.setAuthorityName("");
- configBean.setServiceName(defaultName);
-
-
- net.sf.taverna.t2.workflowmodel.Processor sourceProcessor = edits
- .createProcessor(name);
- BiomobyObjectActivity boActivity = new BiomobyObjectActivity();
- Edit<?> configureActivityEdit = edits
- .getConfigureActivityEdit(
- boActivity, configBean);
- editList.add(configureActivityEdit);
-
- editList
- .add(edits
- .getDefaultDispatchStackEdit(sourceProcessor));
-
- Edit<?> addActivityToProcessorEdit = edits
- .getAddActivityEdit(
- sourceProcessor,
- boActivity);
- editList
- .add(addActivityToProcessorEdit);
-
- String inputPortName = determineInputPortName(defaultName,objectName);
-
- editList.add(edits.getAddProcessorEdit(
- dataflow,
- sourceProcessor));
-
- compoundEdit = new CompoundEdit(
- editList);
- compoundEdit.doEdit();
-
- net.sf.taverna.t2.workflowmodel.Processor sinkProcessor = Tools
- .getProcessorsWithActivity(
- dataflow,
- activity).iterator()
- .next();
-
- List<Edit<?>> linkEditList = new ArrayList<Edit<?>>();
- EventHandlingInputPort sinkPort = getSinkPort(
- sinkProcessor, activity,
- inputPortName, linkEditList);
- EventForwardingOutputPort sourcePort = getSourcePort(
- sourceProcessor, boActivity,
- "mobyData", linkEditList);
-
- linkEditList.add(Tools
- .getCreateAndConnectDatalinkEdit(
- dataflow,
- sourcePort, sinkPort, edits));
- linkEdit = new CompoundEdit(linkEditList);
- linkEdit.doEdit();
-
- if (!(defaultName.equalsIgnoreCase("Object")
- || defaultName.equalsIgnoreCase("String")
- || defaultName.equalsIgnoreCase("Integer")
- || defaultName.equalsIgnoreCase("Float")
- || defaultName.equalsIgnoreCase("DateTime"))) {
- upstreamObjectEdit=new AddUpstreamObjectEdit(dataflow,sourceProcessor,boActivity, edits);
- upstreamObjectEdit.doEdit();
-
- }
- }
-
- protected String determineInputPortName(String defaultName,String objectName) {
- String inputPortName = objectName
- .replaceAll("'", "");
- if (inputPortName.indexOf("()") > 0)
- inputPortName = inputPortName
- .replaceAll("\\(\\)",
- "\\(_ANON_\\)");
- return inputPortName;
- }
-
- /* (non-Javadoc)
- * @see net.sf.taverna.t2.workflowmodel.impl.AbstractDataflowEdit#undoEditAction(net.sf.taverna.t2.workflowmodel.impl.DataflowImpl)
- */
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- if (linkEdit!=null && linkEdit.isApplied())
- linkEdit.undo();
- if (compoundEdit!=null && compoundEdit.isApplied())
- compoundEdit.undo();
- if (upstreamObjectEdit!=null && upstreamObjectEdit.isApplied()) {
- upstreamObjectEdit.undo();
- }
-
- }
-
- private EventHandlingInputPort getSinkPort(
- net.sf.taverna.t2.workflowmodel.Processor processor,
- Activity<?> activity, String portName, List<Edit<?>> editList) {
- InputPort activityPort = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getActivityInputPort(activity, portName);
- // check if processor port exists
- EventHandlingInputPort input = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getProcessorInputPort(processor, activity, activityPort);
- if (input == null) {
- // port doesn't exist so create a processor port and map it
- ProcessorInputPort processorInputPort = edits
- .createProcessorInputPort(processor,
- activityPort.getName(), activityPort.getDepth());
- editList.add(edits.getAddProcessorInputPortEdit(processor,
- processorInputPort));
- editList.add(edits.getAddActivityInputPortMappingEdit(activity,
- activityPort.getName(), activityPort.getName()));
- input = processorInputPort;
- }
- return input;
- }
-
- private EventForwardingOutputPort getSourcePort(
- net.sf.taverna.t2.workflowmodel.Processor processor,
- Activity<?> activity, String portName, List<Edit<?>> editList) {
- OutputPort activityPort = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getActivityOutputPort(activity, portName);
- // check if processor port exists
- EventForwardingOutputPort output = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getProcessorOutputPort(processor, activity, activityPort);
- if (output == null) {
- // port doesn't exist so create a processor port and map it
- ProcessorOutputPort processorOutputPort = edits
- .createProcessorOutputPort(processor, activityPort
- .getName(), activityPort.getDepth(), activityPort
- .getGranularDepth());
- editList.add(edits.getAddProcessorOutputPortEdit(processor,
- processorOutputPort));
- editList.add(edits.getAddActivityOutputPortMappingEdit(activity,
- activityPort.getName(), activityPort.getName()));
- output = processorOutputPort;
- }
- return output;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddMobyParseDatatypeEdit.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddMobyParseDatatypeEdit.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddMobyParseDatatypeEdit.java
deleted file mode 100644
index 43bc61f..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddMobyParseDatatypeEdit.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- */
-package net.sf.taverna.t2.activities.biomoby.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.MobyParseDatatypeActivity;
-import net.sf.taverna.t2.activities.biomoby.MobyParseDatatypeActivityConfigurationBean;
-import net.sf.taverna.t2.workflowmodel.CompoundEdit;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.InputPort;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.impl.AbstractDataflowEdit;
-import net.sf.taverna.t2.workflowmodel.impl.DataflowImpl;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.utils.Tools;
-
-/**
- * @author Stuart Owen
- *
- */
-public class AddMobyParseDatatypeEdit extends AbstractDataflowEdit {
-
- private final BiomobyActivity activity;
- private final String objectName;
- private final boolean isCollection;
- private final String potentialCollectionString;
-
- private Edit<?> compoundEdit = null;
- private Edit<?> linkEdit = null;
-
- private Edits edits;
-
- /**
- * @param dataflow
- */
- public AddMobyParseDatatypeEdit(Dataflow dataflow,
- BiomobyActivity activity, String objectName, boolean isCollection,
- String potentialCollectionString, Edits edits) {
- super(dataflow);
- this.activity = activity;
- this.objectName = objectName;
- this.isCollection = isCollection;
- this.potentialCollectionString = potentialCollectionString;
- this.edits = edits;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * net.sf.taverna.t2.workflowmodel.impl.AbstractEdit#doEditAction(java.lang
- * .Object)
- */
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
-
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
-
- String defaultName = objectName;
- if (defaultName.indexOf("(") > 0)
- defaultName = defaultName.substring(0, defaultName.indexOf("("));
-
- String name = Tools
- .uniqueProcessorName("Parse Moby Data(" + defaultName + ")",
- dataflow);
-
- String articlename = "";
- if (isCollection) {
- articlename = potentialCollectionString.substring(
- potentialCollectionString.indexOf("('") + 2,
- potentialCollectionString.lastIndexOf("'"));
- } else {
- articlename = objectName.substring(objectName.indexOf("'") + 1,
- objectName.lastIndexOf("'"));
- }
-
- MobyParseDatatypeActivityConfigurationBean bean = new MobyParseDatatypeActivityConfigurationBean();
- bean.setArticleNameUsedByService(articlename);
- bean.setRegistryEndpoint(activity.getConfiguration().getMobyEndpoint());
- bean.setDatatypeName(defaultName);
- MobyParseDatatypeActivity mobyDatatypeActivity = new MobyParseDatatypeActivity();
-
- editList
- .add(edits.getConfigureActivityEdit(mobyDatatypeActivity, bean));
-
- net.sf.taverna.t2.workflowmodel.Processor sinkProcessor = edits
- .createProcessor(name);
-
- editList.add(edits.getDefaultDispatchStackEdit(sinkProcessor));
-
- Edit<?> addActivityToProcessorEdit = edits.getAddActivityEdit(
- sinkProcessor, mobyDatatypeActivity);
- editList.add(addActivityToProcessorEdit);
-
- editList.add(edits.getAddProcessorEdit(dataflow, sinkProcessor));
-
- compoundEdit = new CompoundEdit(editList);
- compoundEdit.doEdit();
-
- Processor sourceProcessor = Tools.getProcessorsWithActivity(dataflow,
- activity).iterator().next();
-
- List<Edit<?>> linkEditList = new ArrayList<Edit<?>>();
-
- String inputName = mobyDatatypeActivity.getInputPorts().iterator()
- .next().getName();
- EventHandlingInputPort sinkPort = getSinkPort(sinkProcessor,
- mobyDatatypeActivity, inputName, linkEditList);
-
-
- String outputPortName;
- if (isCollection) {
- outputPortName = defaultName + "(Collection - '"
- + (articlename.equals("") ? "MobyCollection" : articlename)
- + "' As Simples)";
- }
- else {
- outputPortName = defaultName +"(" + articlename + ")";
- }
- EventForwardingOutputPort sourcePort = getSourcePort(sourceProcessor,
- activity, outputPortName, linkEditList);
- linkEditList.add(Tools.getCreateAndConnectDatalinkEdit(dataflow,
- sourcePort, sinkPort, edits));
- linkEdit = new CompoundEdit(linkEditList);
- linkEdit.doEdit();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * net.sf.taverna.t2.workflowmodel.impl.AbstractEdit#undoEditAction(java
- * .lang.Object)
- */
- @Override
- protected void undoEditAction(DataflowImpl subjectImpl) {
- if (linkEdit != null && linkEdit.isApplied())
- linkEdit.undo();
- if (compoundEdit != null && compoundEdit.isApplied())
- compoundEdit.undo();
- }
-
- private EventHandlingInputPort getSinkPort(
- net.sf.taverna.t2.workflowmodel.Processor processor,
- Activity<?> activity, String portName, List<Edit<?>> editList) {
- InputPort activityPort = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getActivityInputPort(activity, portName);
- // check if processor port exists
- EventHandlingInputPort input = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getProcessorInputPort(processor, activity, activityPort);
- if (input == null) {
- // port doesn't exist so create a processor port and map it
- ProcessorInputPort processorInputPort = edits
- .createProcessorInputPort(processor,
- activityPort.getName(), activityPort.getDepth());
- editList.add(edits.getAddProcessorInputPortEdit(processor,
- processorInputPort));
- editList.add(edits.getAddActivityInputPortMappingEdit(activity,
- activityPort.getName(), activityPort.getName()));
- input = processorInputPort;
- }
- return input;
- }
-
- private EventForwardingOutputPort getSourcePort(
- net.sf.taverna.t2.workflowmodel.Processor processor,
- Activity<?> activity, String portName, List<Edit<?>> editList) {
- OutputPort activityPort = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getActivityOutputPort(activity, portName);
- // check if processor port exists
- EventForwardingOutputPort output = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getProcessorOutputPort(processor, activity, activityPort);
- if (output == null) {
- // port doesn't exist so create a processor port and map it
- ProcessorOutputPort processorOutputPort = edits
- .createProcessorOutputPort(processor, activityPort
- .getName(), activityPort.getDepth(), activityPort
- .getGranularDepth());
- editList.add(edits.getAddProcessorOutputPortEdit(processor,
- processorOutputPort));
- editList.add(edits.getAddActivityOutputPortMappingEdit(activity,
- activityPort.getName(), activityPort.getName()));
- output = processorOutputPort;
- }
- return output;
- }
-
-}