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:47:07 UTC
[40/50] [abbrv] incubator-taverna-plugin-bioinformatics git commit:
taverna-soaplab-activity-ui/
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/actions/SoaplabConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/actions/SoaplabConfigurationPanel.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/actions/SoaplabConfigurationPanel.java
new file mode 100644
index 0000000..9b4b0c8
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/actions/SoaplabConfigurationPanel.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.soaplab.actions;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JCheckBox;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.TitledBorder;
+
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
+import uk.org.taverna.scufl2.api.activity.Activity;
+
+@SuppressWarnings("serial")
+public class SoaplabConfigurationPanel extends ActivityConfigurationPanel {
+
+// ActionListener closeClicked;
+// ActionListener applyClicked;
+
+ private JTextField intervalMaxField;
+ private JTextField intervalField;
+ private JTextField backoffField;
+ private JCheckBox allowPolling;
+
+ public SoaplabConfigurationPanel(Activity activity) {
+ super(activity);
+ initialise();
+ }
+
+ public boolean isAllowPolling() {
+ return allowPolling.isSelected();
+ }
+
+ public int getInterval() {
+ return Integer.parseInt(intervalField.getText());
+ }
+
+ public int getIntervalMax() {
+ return Integer.parseInt(intervalMaxField.getText());
+ }
+
+ public double getBackoff() {
+ return Double.parseDouble(backoffField.getText());
+ }
+
+ @Override
+ protected void initialise() {
+ super.initialise();
+ removeAll();
+
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+
+ JPanel interval = new JPanel();
+ interval.setLayout(new BorderLayout());
+ interval.setBorder(new TitledBorder("Interval"));
+
+ JPanel intervalMax = new JPanel();
+ intervalMax.setLayout(new BorderLayout());
+ intervalMax.setBorder(new TitledBorder("Max interval"));
+
+ JPanel backoff = new JPanel();
+ backoff.setLayout(new BorderLayout());
+ backoff.setBorder(new TitledBorder("Backoff"));
+
+ intervalField = new JTextField(getJson().get("pollingInterval").asText());
+ intervalMaxField = new JTextField(getJson().get("pollingIntervalMax").asText());
+ backoffField = new JTextField(getJson().get("pollingBackoff").asText());
+
+ interval.add(intervalField, BorderLayout.CENTER);
+ intervalMax.add(intervalMaxField);
+ backoff.add(backoffField);
+
+ allowPolling = new JCheckBox("Polling?", getJson().get("pollingInterval").intValue() != 0);
+ allowPolling.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ updateEnableForPollingFlag();
+ }
+ });
+
+ updateEnableForPollingFlag();
+ JPanel allowPollingPanel = new JPanel();
+ allowPollingPanel.setLayout(new BorderLayout());
+ allowPollingPanel.add(allowPolling, BorderLayout.WEST);
+ add(allowPollingPanel);
+ add(interval);
+ add(intervalMax);
+ add(backoff);
+ add(Box.createGlue());
+ validate();
+ }
+
+ @Override
+ public void noteConfiguration() {
+ if (validateValues()) {
+ int interval = 0;
+ int intervalMax = 0;
+ double backoff = 1.1;
+
+ if (isAllowPolling()) {
+ interval = getInterval();
+ intervalMax = getIntervalMax();
+ backoff = getBackoff();
+ }
+
+ getJson().put("pollingBackoff", backoff);
+ getJson().put("pollingInterval", interval);
+ getJson().put("pollingIntervalMax", intervalMax);
+ }
+ }
+
+ @Override
+ public boolean checkValues() {
+ // TODO Not yet implemented
+ return true;
+ }
+
+ private void updateEnableForPollingFlag() {
+ boolean enabled = allowPolling.isSelected();
+ intervalField.setEnabled(enabled);
+ intervalMaxField.setEnabled(enabled);
+ backoffField.setEnabled(enabled);
+ }
+
+ public boolean validateValues() {
+ if (allowPolling.isSelected()) {
+ try {
+ new Integer(intervalField.getText());
+ } catch (Exception e) {
+ JOptionPane.showMessageDialog(null, "The interval field must be a valid integer",
+ "Invalid value", JOptionPane.ERROR_MESSAGE);
+ return false;
+
+ }
+
+ try {
+ new Integer(intervalMaxField.getText());
+ } catch (Exception e) {
+ JOptionPane.showMessageDialog(null,
+ "The maximum interval field must be a valid integer", "Invalid value",
+ JOptionPane.ERROR_MESSAGE);
+ return false;
+
+ }
+
+ try {
+ new Double(backoffField.getText());
+ } catch (Exception e) {
+ JOptionPane.showMessageDialog(null, "The backoff field must be a valid float",
+ "Invalid value", JOptionPane.ERROR_MESSAGE);
+ return false;
+
+ }
+ }
+
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/menu/ConfigureSoaplabActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/menu/ConfigureSoaplabActivityMenuAction.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/menu/ConfigureSoaplabActivityMenuAction.java
new file mode 100644
index 0000000..f182ecb
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/menu/ConfigureSoaplabActivityMenuAction.java
@@ -0,0 +1,54 @@
+package net.sf.taverna.t2.activities.soaplab.menu;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.activities.soaplab.actions.SoaplabActivityConfigurationAction;
+import net.sf.taverna.t2.activities.soaplab.servicedescriptions.SoaplabServiceDescription;
+import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.MenuComponent;
+import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
+import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.file.FileManager;
+
+public class ConfigureSoaplabActivityMenuAction extends AbstractConfigureActivityMenuAction
+ implements MenuComponent, ContextualMenuComponent {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+ public ConfigureSoaplabActivityMenuAction() {
+ super(SoaplabServiceDescription.ACTIVITY_TYPE);
+ }
+
+ @Override
+ protected Action createAction() {
+ SoaplabActivityConfigurationAction configAction = new SoaplabActivityConfigurationAction(
+ findActivity(), getParentFrame(), editManager, fileManager, activityIconManager,
+ serviceDescriptionRegistry);
+ configAction.putValue(Action.NAME,
+ SoaplabActivityConfigurationAction.CONFIGURE_SOAPLAB_ACTIVITY);
+ addMenuDots(configAction);
+ return configAction;
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/MissingSoaplabException.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/MissingSoaplabException.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/MissingSoaplabException.java
new file mode 100644
index 0000000..594a7a2
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/MissingSoaplabException.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: MissingSoaplabException.java,v $
+ * Revision $Revision: 1.3 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2008/11/19 17:33:04 $
+ * by $Author: anenadic $
+ * Created on 4 Sep 2006
+ *****************************************************************/
+package net.sf.taverna.t2.activities.soaplab.servicedescriptions;
+
+@SuppressWarnings("serial")
+public class MissingSoaplabException extends Exception {
+
+ public MissingSoaplabException(String msg) {
+ super(msg);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabActivityIcon.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabActivityIcon.java
new file mode 100644
index 0000000..f9d273b
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabActivityIcon.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.soaplab.servicedescriptions;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
+
+/**
+ *
+ * @author Alex Nenadic
+ *
+ */
+public class SoaplabActivityIcon implements ActivityIconSPI{
+
+ private static Icon icon;
+
+ public int canProvideIconScore(URI activityType) {
+ if (SoaplabServiceDescription.ACTIVITY_TYPE.equals(activityType))
+ return DEFAULT_ICON + 1;
+ else
+ return NO_ICON;
+ }
+
+ public Icon getIcon(URI activityType) {
+ return getSoaplabIcon();
+ }
+
+ public static Icon getSoaplabIcon() {
+ if (icon == null) {
+ icon = new ImageIcon(SoaplabActivityIcon.class
+ .getResource("/soaplab.png"));
+ }
+ return icon;
+ }
+
+}
+
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabCategory.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabCategory.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabCategory.java
new file mode 100644
index 0000000..47f994c
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabCategory.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: SoaplabCategory.java,v $
+ * Revision $Revision: 1.2 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2008/09/04 13:40:38 $
+ * by $Author: sowen70 $
+ * Created on 4 Sep 2006
+ *****************************************************************/
+package net.sf.taverna.t2.activities.soaplab.servicedescriptions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SoaplabCategory {
+
+ private String category;
+ private List<String> services = new ArrayList<String>();
+
+ public SoaplabCategory(String category) {
+ this.category=category;
+ }
+
+ public boolean addService(String service) {
+ return services.add(service);
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public List<String> getServices() {
+ return services;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabScavengerAgent.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabScavengerAgent.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabScavengerAgent.java
new file mode 100644
index 0000000..fe428ec
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabScavengerAgent.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: SoaplabScavengerAgent.java,v $
+ * Revision $Revision: 1.2 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2008/09/04 13:40:37 $
+ * by $Author: sowen70 $
+ * Created on 4 Sep 2006
+ *****************************************************************/
+package net.sf.taverna.t2.activities.soaplab.servicedescriptions;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.rpc.ServiceException;
+
+import org.apache.axis.client.Call;
+import org.apache.axis.client.Service;
+import org.apache.log4j.Logger;
+
+/**
+ * An agent to query Soaplab server to determine the available categories and services.
+ * @author sowen
+ *
+ */
+
+public class SoaplabScavengerAgent {
+
+ private static Logger logger = Logger.getLogger(SoaplabScavengerAgent.class);
+
+ /**
+ * Returns a list of soaplab categories, containing a list of their services.
+ * Throws MissingSoaplabException if an installation cannot be found.
+ */
+ public static List<SoaplabCategory> load(String base) throws MissingSoaplabException{
+ List<SoaplabCategory> categories=new ArrayList<SoaplabCategory>();
+
+ // Get the categories for this installation
+ boolean foundAnInstallation = loadCategories(base + "AnalysisFactory",categories);
+
+ // Yes, bitwise OR is on purpose, to make sure the second
+ // loadCategories() is always run. Do NOT replace with
+ // foundInstallation = foundInstallation || getCategories(..)
+ foundAnInstallation |= loadCategories(base + "GowlabFactory",categories);
+ if (!foundAnInstallation) {
+ // Neither Soaplab nor Gowlab were found, probably a fault
+ throw new MissingSoaplabException("Unable to locate a soaplab installation at \n" + base);
+ }
+
+ return categories;
+
+ }
+
+
+ private static boolean loadCategories(String categoryBase, List<SoaplabCategory>cats) {
+ boolean foundSome = false;
+ String[] categories;
+ try {
+ categories = (String[]) callWebService(categoryBase, "getAvailableCategories", new Object[0]);
+ } catch (Exception e) {
+ logger.debug("Missing category: "+categoryBase, e);
+ return false;
+ }
+ // Iterate over all the categories, creating new child nodes
+ for (int i = 0; i < categories.length; i++) {
+ String[] services;
+ try {
+ services = (String[]) callWebService(categoryBase, "getAvailableAnalysesInCategory", new Object[] {categories[i]});
+ } catch (Exception e) {
+ logger.info("Skipping category " + categories[i], e);
+ continue;
+ }
+ if (services.length == 0) {
+ // Avoid creating empty treenodes
+ continue;
+ }
+
+ SoaplabCategory category=new SoaplabCategory(categories[i]);
+ cats.add(category);
+
+ foundSome = true;
+ // Iterate over the services
+ for (int j = 0; j < services.length; j++) {
+ category.addService(services[j]);
+ }
+ }
+ return foundSome;
+ }
+
+ public static Object callWebService(String target, String operation,
+ Object[] parameters) throws ServiceException, RemoteException {
+ Service service = new Service();
+ Call call = (Call) service.createCall();
+ call.setTargetEndpointAddress(target);
+ // No need to do new Qname(operation) with unspecified namespaces
+ call.setOperationName(operation);
+ return call.invoke(parameters);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceDescription.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceDescription.java
new file mode 100644
index 0000000..99a25b3
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceDescription.java
@@ -0,0 +1,131 @@
+package net.sf.taverna.t2.activities.soaplab.servicedescriptions;
+
+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.servicedescriptions.ServiceDescription;
+import uk.org.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class SoaplabServiceDescription extends ServiceDescription {
+
+ public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/soaplab");
+
+ private final static String SOAPLAB = "Soaplab @ ";
+
+ private String category;
+ private String operation;
+ private URI endpoint;
+ private List<String> types;
+
+ private String name;
+
+ public List<String> getTypes() {
+ return types;
+ }
+
+ /**
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * @param category
+ * the category to set
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * @return the operation
+ */
+ public String getOperation() {
+ return operation;
+ }
+
+ /**
+ * @param operation
+ * the operation to set
+ */
+ public void setOperation(final String operation) {
+ this.operation = operation;
+
+ String name = operation;
+ int finalColon = operation.lastIndexOf(":");
+ if (finalColon != -1) {
+ name = operation.substring(finalColon + 1);
+ }
+ int finalDot = operation.lastIndexOf(".");
+ if (finalDot != -1) {
+ name = operation.substring(finalDot + 1);
+ }
+ setName(name);
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ @Override
+ public URI getActivityType() {
+ return ACTIVITY_TYPE;
+ }
+
+ @Override
+ public Configuration getActivityConfiguration() {
+ Configuration configuration = new Configuration();
+ configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
+ ((ObjectNode) configuration.getJson()).put("endpoint", getEndpoint().toASCIIString() + getOperation());
+ ((ObjectNode) configuration.getJson()).put("pollingInterval", 0);
+ ((ObjectNode) configuration.getJson()).put("pollingBackoff", 1.0);
+ ((ObjectNode) configuration.getJson()).put("pollingIntervalMax", 0);
+ return configuration;
+ }
+
+ @Override
+ public Icon getIcon() {
+ return SoaplabActivityIcon.getSoaplabIcon();
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public List<String> getPath() {
+ List<String> path = new ArrayList<String>();
+ path.add(SOAPLAB + getEndpoint());
+ path.add(getCategory());
+ // Don't use getTypes() - as we end up
+ // with double entries..
+ return path;
+ }
+
+ public void setTypes(List<String> types) {
+ this.types = types;
+ }
+
+ public void setEndpoint(URI endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public URI getEndpoint() {
+ return endpoint;
+ }
+
+ @Override
+ protected List<Object> getIdentifyingData() {
+ return Arrays.<Object>asList(getEndpoint(), getOperation());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceProvider.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceProvider.java
new file mode 100644
index 0000000..54080c9
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceProvider.java
@@ -0,0 +1,183 @@
+package net.sf.taverna.t2.activities.soaplab.servicedescriptions;
+
+import java.net.URI;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.Icon;
+import javax.xml.rpc.ServiceException;
+
+import net.sf.taverna.t2.activities.soaplab.Soap;
+import net.sf.taverna.t2.servicedescriptions.AbstractConfigurableServiceProvider;
+import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
+
+import org.apache.log4j.Logger;
+
+public class SoaplabServiceProvider extends
+ AbstractConfigurableServiceProvider<SoaplabServiceProviderConfig> {
+
+ // To avoid hammering the soaplab service
+ private static final int DELAY_MS = 100;
+ private static final int DESCRIPTION_UPDATE_INTERVAL_MS = 2000;
+
+ private static Logger logger = Logger
+ .getLogger(SoaplabServiceProvider.class);
+
+ private static final String SOAPLAB_SERVICE = "Soaplab service";
+ private static final boolean FIND_DETAILS = false;
+
+ private static final URI providerId = URI
+ .create("http://taverna.sf.net/2010/service-provider/soaplab");
+
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+ public SoaplabServiceProvider() {
+ super(new SoaplabServiceProviderConfig(
+ "http://somehost/soaplab/services/"));
+ }
+
+ public void findServiceDescriptionsAsync(
+ FindServiceDescriptionsCallBack callBack) {
+ List<SoaplabServiceDescription> descriptions = findSoaplabServices(callBack);
+ if (descriptions == null) {
+ return;
+ }
+ callBack.partialResults(descriptions);
+
+ if (FIND_DETAILS) {
+ if (findSoaplabDetails(descriptions, callBack)) {
+ callBack.finished();
+ }
+ } else {
+ callBack.finished();
+ }
+ }
+
+ public List<SoaplabServiceProviderConfig> getDefaultConfigurations() {
+
+ List<SoaplabServiceProviderConfig> defaults = new ArrayList<SoaplabServiceProviderConfig>();
+
+ // If defaults have failed to load from a configuration file then load them here.
+ if (!serviceDescriptionRegistry.isDefaultSystemConfigurableProvidersLoaded()){
+ defaults.add(new SoaplabServiceProviderConfig(
+ "http://wsembnet.vital-it.ch/soaplab2-axis/services/"));
+ } // else return an empty list
+
+ return defaults;
+ }
+
+ public Icon getIcon() {
+ return SoaplabActivityIcon.getSoaplabIcon();
+ }
+
+ public String getName() {
+ return SOAPLAB_SERVICE;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected boolean findSoaplabDetails(
+ List<SoaplabServiceDescription> descriptions,
+ FindServiceDescriptionsCallBack callBack) {
+ Date lastUpdate = new Date();
+ // We'll fetch more details and update the descriptions in the
+ // background
+ List<SoaplabServiceDescription> updatedDescriptions = new ArrayList<SoaplabServiceDescription>();
+ for (SoaplabServiceDescription serviceDescription : descriptions) {
+ try {
+ Date now = new Date();
+ if (now.getTime() - lastUpdate.getTime() > DESCRIPTION_UPDATE_INTERVAL_MS) {
+ if (!updatedDescriptions.isEmpty()) {
+ callBack.partialResults(updatedDescriptions);
+ updatedDescriptions = new ArrayList<SoaplabServiceDescription>();
+ }
+ lastUpdate = now;
+ }
+ Thread.sleep(DELAY_MS);
+ URI soaplabEndpoint = serviceProviderConfig.getEndpoint();
+ Map info = (Map) Soap.callWebService(soaplabEndpoint
+ .toASCIIString()
+ + "/" + serviceDescription.getOperation(),
+ "getAnalysisType"); // Get the description element from
+ // the map
+ String description = (String) info.get("description");
+ if (description != null) {
+ serviceDescription.setDescription(description);
+ }
+ updatedDescriptions.add(serviceDescription);
+ String type = (String) info.get("type");
+ if (type != null) {
+ serviceDescription.setTypes(Arrays.asList(type.split(",")));
+ }
+ } catch (ClassCastException e) {
+ logger.warn("Can't read descriptions for soaplab service "
+ + serviceDescription, e);
+ callBack.warning("Can't read descriptions for soaplab service "
+ + serviceDescription.getOperation());
+ } catch (ServiceException e) {
+ logger.warn("Can't read descriptions for soaplab service "
+ + serviceDescription, e);
+ callBack.warning("Can't read descriptions for soaplab service "
+ + serviceDescription.getOperation());
+ } catch (RemoteException e) {
+ logger.warn("Can't read descriptions for soaplab service "
+ + serviceDescription, e);
+ callBack.warning("Can't read descriptions for soaplab service "
+ + serviceDescription.getOperation());
+ } catch (InterruptedException ex) {
+ callBack.fail("Thread was interrupted", ex);
+ return false;
+ }
+ }
+ if (!updatedDescriptions.isEmpty()) {
+ callBack.partialResults(updatedDescriptions);
+ }
+ return true;
+ }
+
+ protected List<SoaplabServiceDescription> findSoaplabServices(
+ FindServiceDescriptionsCallBack callBack) {
+ List<SoaplabServiceDescription> descriptions = new ArrayList<SoaplabServiceDescription>();
+ URI soaplabEndpoint = serviceProviderConfig.getEndpoint();
+ callBack.status("Connecting to Soaplab:" + soaplabEndpoint);
+ List<SoaplabCategory> categories;
+ try {
+ categories = SoaplabScavengerAgent.load(soaplabEndpoint
+ .toASCIIString());
+ } catch (MissingSoaplabException ex) {
+ String message = "There was an error with the soaplab: "
+ + soaplabEndpoint;
+ callBack.fail(message, ex);
+ return null;
+ }
+ for (SoaplabCategory cat : categories) {
+ for (String service : cat.getServices()) {
+ SoaplabServiceDescription item = new SoaplabServiceDescription();
+ item.setCategory(cat.getCategory());
+ item.setOperation(service);
+ item.setEndpoint(soaplabEndpoint);
+ descriptions.add(item);
+ }
+ }
+ return descriptions;
+ }
+
+ @Override
+ protected List<? extends Object> getIdentifyingData() {
+ List<String> result;
+ result = Arrays.asList(getConfiguration().getEndpoint().toString());
+ return result;
+ }
+
+ public String getId() {
+ return providerId.toString();
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceProviderConfig.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceProviderConfig.java
new file mode 100644
index 0000000..d1e86da
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/servicedescriptions/SoaplabServiceProviderConfig.java
@@ -0,0 +1,38 @@
+package net.sf.taverna.t2.activities.soaplab.servicedescriptions;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.lang.beans.PropertyAnnotated;
+import net.sf.taverna.t2.lang.beans.PropertyAnnotation;
+
+public class SoaplabServiceProviderConfig extends PropertyAnnotated {
+
+ private URI endpoint;
+
+ public SoaplabServiceProviderConfig() {
+ }
+
+ public SoaplabServiceProviderConfig(String endpointURI) {
+ this.setEndpoint(URI.create(endpointURI.trim()));
+ }
+
+ @PropertyAnnotation(displayName = "Soaplab location", preferred = true)
+ public URI getEndpoint() {
+ return endpoint;
+ }
+
+ public String toString() {
+ return getEndpoint().toString();
+ }
+
+ public void setEndpoint(URI endpoint) {
+ String uriString = endpoint.toString();
+ if (!uriString.endsWith("/")) {
+ uriString = uriString + "/";
+ this.endpoint = URI.create(uriString);
+ } else {
+ this.endpoint = endpoint;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/views/SoaplabActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/views/SoaplabActivityContextualView.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/views/SoaplabActivityContextualView.java
new file mode 100644
index 0000000..de51f23
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/views/SoaplabActivityContextualView.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.soaplab.views;
+
+import java.awt.Frame;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.net.URL;
+
+import javax.swing.Action;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import net.sf.taverna.t2.activities.soaplab.actions.SoaplabActivityConfigurationAction;
+import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
+import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
+import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+
+import org.apache.axis.client.Call;
+import org.apache.axis.client.Service;
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class SoaplabActivityContextualView extends HTMLBasedActivityContextualView {
+
+ private static Logger logger = Logger.getLogger(SoaplabActivityContextualView.class);
+
+ private static final long serialVersionUID = -6470801873448104509L;
+
+ private final EditManager editManager;
+
+ private final FileManager fileManager;
+
+ private final ActivityIconManager activityIconManager;
+
+ private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+ public SoaplabActivityContextualView(Activity activity, EditManager editManager,
+ FileManager fileManager, ActivityIconManager activityIconManager,
+ ColourManager colourManager, ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ super(activity, colourManager);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.activityIconManager = activityIconManager;
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ @Override
+ public String getViewTitle() {
+ return "Soaplab service";
+ }
+
+ @Override
+ protected String getRawTableRowsHtml() {
+ Configuration configuration = getConfigBean();
+ JsonNode json = configuration.getJson();
+ String html = "<tr><td>Endpoint</td><td>" + json.get("endpoint").textValue() + "</td></tr>";
+ html += "<tr><td>Polling interval</td><td>" + json.get("pollingInterval").asText()
+ + "</td></tr>";
+ html += "<tr><td>Polling backoff</td><td>" + json.get("pollingBackoff").asText()
+ + "</td></tr>";
+ html += "<tr><td>Polling interval max</td><td>" + json.get("pollingIntervalMax").asText()
+ + "</td></tr>";
+ // html += "<tr><td>SOAPLAB Metadata</td><td>" + getMetadata()
+ // + "</td></tr>";
+ return html;
+ }
+
+ @Override
+ public Action getConfigureAction(Frame owner) {
+ return new SoaplabActivityConfigurationAction(getActivity(), owner, editManager,
+ fileManager, activityIconManager, serviceDescriptionRegistry);
+ }
+
+ private String getMetadata() {
+ try {
+ Configuration configuration = getConfigBean();
+ JsonNode json = configuration.getJson();
+ String endpoint = json.get("endpoint").textValue();
+ Call call = (Call) new Service().createCall();
+ call.setTimeout(new Integer(0));
+ call.setTargetEndpointAddress(endpoint);
+ call.setOperationName(new QName("describe"));
+ String metadata = (String) call.invoke(new Object[0]);
+ logger.info(metadata);
+ // Old impl, returns a tree of the XML
+ // ColXMLTree tree = new ColXMLTree(metadata);
+ URL sheetURL = SoaplabActivityContextualView.class
+ .getResource("/analysis_metadata_2_html.xsl");
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ logger.info(sheetURL.toString());
+ Templates stylesheet = transformerFactory.newTemplates(new StreamSource(sheetURL
+ .openStream()));
+ Transformer transformer = stylesheet.newTransformer();
+ StreamSource inputStream = new StreamSource(new ByteArrayInputStream(
+ metadata.getBytes()));
+ ByteArrayOutputStream transformedStream = new ByteArrayOutputStream();
+ StreamResult result = new StreamResult(transformedStream);
+ transformer.transform(inputStream, result);
+ transformedStream.flush();
+ transformedStream.close();
+ // String summaryText = "<html><head>"
+ // + WorkflowSummaryAsHTML.STYLE_NOBG + "</head>"
+ // + transformedStream.toString() + "</html>";
+ // JEditorPane metadataPane = new ColJEditorPane("text/html",
+ // summaryText);
+ // metadataPane.setText(transformedStream.toString());
+ // // logger.info(transformedStream.toString());
+ // JScrollPane jsp = new JScrollPane(metadataPane,
+ // JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ // JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ // jsp.setPreferredSize(new Dimension(0, 0));
+ // jsp.getVerticalScrollBar().setValue(0);
+ return transformedStream.toString();
+ } catch (Exception ex) {
+ return "<font color=\"red\">Error</font><p>An exception occured while trying to fetch Soaplab metadata from the server. The error was :<pre>"
+ + ex.getMessage() + "</pre>";
+
+ }
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ return 100;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/views/SoaplabActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/views/SoaplabActivityViewFactory.java b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/views/SoaplabActivityViewFactory.java
new file mode 100644
index 0000000..23e94d8
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/java/net/sf/taverna/t2/activities/soaplab/views/SoaplabActivityViewFactory.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.soaplab.views;
+
+import java.util.Arrays;
+import java.util.List;
+
+import net.sf.taverna.t2.activities.soaplab.servicedescriptions.SoaplabServiceDescription;
+import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
+import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
+import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import uk.org.taverna.scufl2.api.activity.Activity;
+
+public class SoaplabActivityViewFactory implements ContextualViewFactory<Activity> {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ColourManager colourManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+ public boolean canHandle(Object object) {
+ return object instanceof Activity && ((Activity) object).getType().equals(SoaplabServiceDescription.ACTIVITY_TYPE);
+ }
+
+ public List<ContextualView> getViews(Activity activity) {
+ return Arrays.asList(new ContextualView[] { new SoaplabActivityContextualView(activity,
+ editManager, fileManager, activityIconManager, colourManager, serviceDescriptionRegistry) });
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ this.colourManager = colourManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
new file mode 100644
index 0000000..fb73ade
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
@@ -0,0 +1 @@
+net.sf.taverna.t2.activities.soaplab.servicedescriptions.SoaplabServiceProvider
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
new file mode 100644
index 0000000..1eeb850
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
@@ -0,0 +1 @@
+net.sf.taverna.t2.activities.soaplab.menu.ConfigureSoaplabActivityMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
new file mode 100644
index 0000000..0bb5227
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
@@ -0,0 +1 @@
+net.sf.taverna.t2.activities.soaplab.servicedescriptions.SoaplabActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..ea7da0b
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+net.sf.taverna.t2.activities.soaplab.views.SoaplabActivityViewFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/resources/META-INF/spring/soaplab-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/resources/META-INF/spring/soaplab-activity-ui-context-osgi.xml b/taverna-soaplab-activity-ui/src/main/resources/META-INF/spring/soaplab-activity-ui-context-osgi.xml
new file mode 100644
index 0000000..f7e486e
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/resources/META-INF/spring/soaplab-activity-ui-context-osgi.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+ <service ref="SoaplabActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
+
+ <service ref="SoaplabServiceProvider">
+ <interfaces>
+ <beans:value>net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider</beans:value>
+ <beans:value>net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider</beans:value>
+ </interfaces>
+ </service>
+
+ <service ref="ConfigureSoaplabActivityMenuAction" auto-export="interfaces" />
+
+ <service ref="SoaplabActivityViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+
+ <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
+ <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
+ <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
+ <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
+ <reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry" />
+
+</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/resources/META-INF/spring/soaplab-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/resources/META-INF/spring/soaplab-activity-ui-context.xml b/taverna-soaplab-activity-ui/src/main/resources/META-INF/spring/soaplab-activity-ui-context.xml
new file mode 100644
index 0000000..7f99ff2
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/resources/META-INF/spring/soaplab-activity-ui-context.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="SoaplabActivityIcon" class="net.sf.taverna.t2.activities.soaplab.servicedescriptions.SoaplabActivityIcon" />
+
+ <bean id="SoaplabServiceProvider" class="net.sf.taverna.t2.activities.soaplab.servicedescriptions.SoaplabServiceProvider">
+ <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
+ </bean>
+
+ <bean id="ConfigureSoaplabActivityMenuAction" class="net.sf.taverna.t2.activities.soaplab.menu.ConfigureSoaplabActivityMenuAction">
+ <property name="editManager" ref="editManager" />
+ <property name="fileManager" ref="fileManager" />
+ <property name="activityIconManager" ref="activityIconManager" />
+ <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
+ </bean>
+
+ <bean id="SoaplabActivityViewFactory" class="net.sf.taverna.t2.activities.soaplab.views.SoaplabActivityViewFactory" >
+ <property name="editManager" ref="editManager" />
+ <property name="fileManager" ref="fileManager" />
+ <property name="activityIconManager" ref="activityIconManager" />
+ <property name="colourManager" ref="colourManager" />
+ <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
+ </bean>
+
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/resources/analysis_metadata_2_html.xsl
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/resources/analysis_metadata_2_html.xsl b/taverna-soaplab-activity-ui/src/main/resources/analysis_metadata_2_html.xsl
new file mode 100644
index 0000000..5095e5c
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/main/resources/analysis_metadata_2_html.xsl
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- ===================================================================== -->
+<!-- Converting analysis metadata returned by Soaplab Web Services to HTML -->
+<!-- (http://www.ebi.ac.uk/soaplab/) -->
+<!-- Author: Martin Senger (senger@ebi.ac.uk) -->
+<!-- ===================================================================== -->
+
+<!-- $Id: analysis_metadata_2_html.xsl,v 1.1 2008/07/14 15:27:42 iandunlop Exp $ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+ <xsl:output method="html"/>
+
+ <!-- the main document body -->
+ <xsl:template match="/">
+ <body>
+ <xsl:apply-templates/>
+ </body>
+ </xsl:template>
+
+ <!-- analysis -->
+ <xsl:template match="/DsLSRAnalysis/analysis">
+
+ <!-- analysis name -->
+ <table border="0" cellpadding="2" cellspacing="3" width="98%" align="center"><tr><th bgcolor="#eeeedd">
+ <font size="+1"><xsl:value-of select="@name"/></font>
+ </th></tr></table>
+
+ <!-- analysis metadata -->
+ <table border="0" cellspacing="1" cellpadding="1" width="99%" align="center"><tr>
+ <td>
+ <table border="0" cellspacing="2">
+ <xsl:apply-templates select="description" mode="as-row"/>
+ <xsl:apply-templates select="analysis_extension/app_info/@*[local-name != 'help_URL']" mode="as-row"/>
+ <xsl:apply-templates select="@*[local-name() != 'name']" mode="as-row"/>
+ <tr><td>Help URL</td><td><a href="{analysis_extension/app_info/@help_URL}"><xsl:value-of select="analysis_extension/app_info/@help_URL"/></a></td></tr>
+ </table>
+ </td></tr></table>
+
+ <!-- inputs/outputs metadata -->
+ <table border="0" width="98%" cellpadding="2" cellspacing="1" align="center">
+ <tr><td colspan="2" bgcolor="#eeeedd"> <b>Outputs</b> </td></tr>
+ <xsl:apply-templates select="output"/>
+ <tr><td colspan="2" bgcolor="#eeeedd"> <b>Inputs</b> </td></tr>
+ <xsl:apply-templates select="input"/>
+ </table>
+
+ </xsl:template>
+
+ <!-- metadata about one input or output -->
+ <xsl:template match="input|output">
+ <xsl:variable name="param_name" select="@name"/>
+ <tr bgcolor="#eae9c2">
+ <td valign="top"><b><xsl:value-of select="@name"/></b></td>
+ <td><table border="0" cellspacing="1" cellpadding="1" bgcolor="white" width="100%">
+ <xsl:apply-templates select="@*[local-name() != 'name']" mode="as-row"/>
+ <xsl:apply-templates select="allowed" mode="as-row"/>
+ <xsl:apply-templates select="../analysis_extension/parameter/base[@name =$param_name]/*" mode="as-row"/>
+ <xsl:apply-templates select="../analysis_extension/parameter/base[concat(@name,'_url') =$param_name]/*" mode="as-row"/>
+ <xsl:apply-templates select="../analysis_extension/parameter/base[concat(@name,'_direct_data')=$param_name]/*" mode="as-row"/>
+ <xsl:apply-templates select="../analysis_extension/parameter/base[concat(@name,'_usa') =$param_name]/*" mode="as-row"/>
+ </table></td>
+ </tr>
+ </xsl:template>
+
+ <!-- attributes and elements expressed as a (bold)name and value -->
+ <xsl:template match="@*[local-name() != 'help_URL']|description|default|prompt|help" mode="as-row">
+ <tr>
+ <td valign="top" width="80"><em><xsl:value-of select="local-name()"/></em></td>
+ <td><xsl:value-of select="."/></td>
+ </tr>
+ </xsl:template>
+
+ <!-- more-values elements -->
+ <xsl:template match="allowed" mode="as-row">
+
+ <xsl:if test="position() = 1">
+ <xsl:text disable-output-escaping = "yes"><tr></xsl:text>
+ <td valign="top" width="80"><em><xsl:value-of select="local-name()"/></em></td>
+ <xsl:text disable-output-escaping = "yes"><td></xsl:text>
+ </xsl:if>
+
+ <xsl:value-of select="."/>
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+
+ <xsl:if test="position() = last()">
+ <xsl:text disable-output-escaping = "yes"></td></xsl:text>
+ <xsl:text disable-output-escaping = "yes"></tr></xsl:text>
+ </xsl:if>
+
+ </xsl:template>
+
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/main/resources/soaplab.png
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/main/resources/soaplab.png b/taverna-soaplab-activity-ui/src/main/resources/soaplab.png
new file mode 100644
index 0000000..b86d848
Binary files /dev/null and b/taverna-soaplab-activity-ui/src/main/resources/soaplab.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/418e332b/taverna-soaplab-activity-ui/src/test/java/net/sf/taverna/t2/activities/soaplab/views/TestSoaplabActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-soaplab-activity-ui/src/test/java/net/sf/taverna/t2/activities/soaplab/views/TestSoaplabActivityContextualView.java b/taverna-soaplab-activity-ui/src/test/java/net/sf/taverna/t2/activities/soaplab/views/TestSoaplabActivityContextualView.java
new file mode 100644
index 0000000..c4d683d
--- /dev/null
+++ b/taverna-soaplab-activity-ui/src/test/java/net/sf/taverna/t2/activities/soaplab/views/TestSoaplabActivityContextualView.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.soaplab.views;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import net.sf.taverna.t2.activities.soaplab.actions.SoaplabActivityConfigurationAction;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.activity.Activity;
+
+public class TestSoaplabActivityContextualView {
+
+ Activity a;
+
+ @Before
+ public void setup() throws Exception {
+ a=new Activity();
+ }
+
+ @Test
+ @Ignore("Integration test")
+ public void testConfigureAction() throws Exception {
+ ContextualView view = new SoaplabActivityContextualView(a, null, null, null, null, null);
+ assertNotNull("the action should not be null",view.getConfigureAction(null));
+ assertTrue("The action should be a SoaplabAcitivyConfigurationAction",view.getConfigureAction(null) instanceof SoaplabActivityConfigurationAction);
+ }
+
+ private void run() throws Exception
+ {
+ setup();
+ ContextualView view = new SoaplabActivityContextualView(a, null, null, null, null, null);
+ view.setVisible(true);
+ }
+
+ public static void main(String[] args) throws Exception {
+ new TestSoaplabActivityContextualView().run();
+ }
+}