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:02 UTC

[35/50] [abbrv] incubator-taverna-plugin-bioinformatics git commit: taverna-biomart-activity/

taverna-biomart-activity/


Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/commit/24c4d3c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/tree/24c4d3c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/diff/24c4d3c6

Branch: refs/heads/master
Commit: 24c4d3c6a84938b85921a8eaf5b93346f5841e85
Parents: 87e247d
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Mon Feb 2 09:50:17 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Mon Feb 2 09:55:09 2015 +0000

----------------------------------------------------------------------
 .gitignore                                      |  24 --
 .travis.yml                                     |   1 -
 README.md                                       |   3 -
 pom.xml                                         |  77 ----
 .../t2/activities/biomart/BiomartActivity.java  | 351 -------------------
 .../BiomartActivityConfigurationBean.java       |  47 ---
 .../biomart/BiomartActivityFactory.java         | 144 --------
 .../biomart/BiomartActivityHealthChecker.java   |  76 ----
 ...averna.t2.workflowmodel.health.HealthChecker |   1 -
 .../spring/biomart-activity-context-osgi.xml    |  15 -
 .../spring/biomart-activity-context.xml         |  13 -
 src/main/resources/schema.json                  |  19 -
 .../biomart/BiomartActivityFactoryTest.java     |  65 ----
 src/test/resources/biomart-query.xml            |  17 -
 taverna-biomart-activity/pom.xml                |  77 ++++
 .../t2/activities/biomart/BiomartActivity.java  | 351 +++++++++++++++++++
 .../BiomartActivityConfigurationBean.java       |  47 +++
 .../biomart/BiomartActivityFactory.java         | 144 ++++++++
 .../biomart/BiomartActivityHealthChecker.java   |  76 ++++
 ...averna.t2.workflowmodel.health.HealthChecker |   1 +
 .../spring/biomart-activity-context-osgi.xml    |  15 +
 .../spring/biomart-activity-context.xml         |  13 +
 .../src/main/resources/schema.json              |  19 +
 .../biomart/BiomartActivityFactoryTest.java     |  65 ++++
 .../src/test/resources/biomart-query.xml        |  17 +
 25 files changed, 825 insertions(+), 853 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 68b251b..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# ignore project files # 
-.classpath
-.project
-.settings/
-catalog-v001.xml
-
-# ignore target files #
-target/
-bin/
-build/
-dist/
-apidoc/
-*.swp
-
-# ignore svn files if there
-.svn
-
-# ignore log files #
-*.log
-/logs/*
-*/logs/*
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index dff5f3a..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1 +0,0 @@
-language: java

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
deleted file mode 100644
index a5fb132..0000000
--- a/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Taverna Workflow system BioMart Activity: data model and execution implementation
- 
-This code was previously hosted at http://taverna.googlecode.com/svn/taverna/engine/net.sf.taverna.t2.activities/

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 2662e59..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>net.sf.taverna</groupId>
-		<artifactId>taverna-parent</artifactId>
-		<version>3.0.1-SNAPSHOT</version>
-	</parent>
-	<groupId>net.sf.taverna.t2.activities</groupId>
-	<version>2.0.1-SNAPSHOT</version>
-	<artifactId>biomart-activity</artifactId>
-	<packaging>bundle</packaging>
-	<name>Taverna 2 Biomart Activity.</name>
-	<dependencies>
-		<dependency>
-			<groupId>org.biomart</groupId>
-			<artifactId>martservice</artifactId>
-			<version>2.0.1-SNAPSHOT</version>
-		</dependency>
-		<dependency>
-			<groupId>net.sf.taverna.t2.core</groupId>
-			<artifactId>workflowmodel-api</artifactId>
-			<version>${t2.core.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>net.sf.taverna.t2.core</groupId>
-			<artifactId>reference-api</artifactId>
-			<version>${t2.core.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>com.fasterxml.jackson.core</groupId>
-			<artifactId>jackson-databind</artifactId>
-			<version>${jackson-databind.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>${junit.version}</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>net.sf.taverna.t2.activities</groupId>
-			<artifactId>activity-test-utils</artifactId>
-			<version>${t2.activities.version}</version>
-			<scope>test</scope>
-		</dependency>
-	</dependencies>
-
-	<repositories>
-		<repository>
-			<releases />
-			<snapshots>
-				<enabled>false</enabled>
-			</snapshots>
-			<id>mygrid-repository</id>
-			<name>myGrid Repository</name>
-			<url>http://www.mygrid.org.uk/maven/repository</url>
-		</repository>
-		<repository>
-			<releases>
-				<enabled>false</enabled>
-			</releases>
-			<snapshots />
-			<id>mygrid-snapshot-repository</id>
-			<name>myGrid Snapshot Repository</name>
-			<url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
-		</repository>
-	</repositories>
-	<scm>
-		<connection>scm:git:https://github.com/taverna/taverna-biomart-activity.git</connection>
-		<developerConnection>scm:git:ssh://git@github.com/taverna/taverna-biomart-activity.git</developerConnection>
-		<url>https://github.com/taverna/taverna-biomart-activity/</url>
-		<tag>HEAD</tag>
-	</scm>
-</project>
-

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivity.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivity.java b/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivity.java
deleted file mode 100644
index 7e87939..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivity.java
+++ /dev/null
@@ -1,351 +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
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomart;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.ReferenceServiceException;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-
-import org.apache.log4j.Logger;
-import org.biomart.martservice.MartQuery;
-import org.biomart.martservice.MartServiceException;
-import org.biomart.martservice.MartServiceXMLHandler;
-import org.biomart.martservice.ResultReceiver;
-import org.biomart.martservice.ResultReceiverException;
-import org.biomart.martservice.config.QueryConfigUtils;
-import org.biomart.martservice.query.Attribute;
-import org.biomart.martservice.query.Dataset;
-import org.biomart.martservice.query.Filter;
-import org.biomart.martservice.query.Query;
-import org.jdom.Document;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * An Activity providing Biomart functionality.
- *
- * @author David Withers
- */
-public class BiomartActivity extends AbstractAsynchronousActivity<JsonNode> {
-
-	public static final String URI = "http://ns.taverna.org.uk/2010/activity/biomart";
-
-	static boolean STREAM_RESULTS = true;
-
-	private static Logger logger = Logger.getLogger(BiomartActivity.class);
-	
-	private JsonNode json;
-
-	private MartQuery biomartQuery;
-
-	@Override
-	public void configure(JsonNode json)
-			throws ActivityConfigurationException {
-		this.json = json;
-		String martQueryText = json.get("martQuery").asText();
-		SAXBuilder builder = new SAXBuilder();
-		try {
-			Document document = builder.build(new StringReader(martQueryText));
-			biomartQuery = MartServiceXMLHandler.elementToMartQuery(document.getRootElement(), null);
-		} catch (JDOMException | IOException e) {
-			throw new ActivityConfigurationException(e);
-		}
-	}
-
-	@Override
-	public JsonNode getConfiguration() {
-		return json;
-	}
-
-	@Override
-	public void executeAsynch(final Map<String, T2Reference> data,
-			final AsynchronousActivityCallback callback) {
-		callback.requestRun(new Runnable() {
-
-			public void run() {
-				final ReferenceService referenceService = callback.getContext().getReferenceService();
-
-				final Map<String, T2Reference> outputData = new HashMap<String, T2Reference>();
-
-				try {
-					// Get a query including data source etc, creating
-					// a copy so that any filter value settings are not
-					// overwritten by input values
-					biomartQuery.calculateLinks();
-					Query query = new Query(biomartQuery.getQuery());
-
-					// Configure any filters
-					List<Filter> filters = query.getFilters();
-					for (Filter filter : filters) {
-						String name = filter.getQualifiedName();
-						if (data.containsKey(name + "_filter")) {
-							Object filterValue = referenceService.renderIdentifier(data
-									.get(name + "_filter"), String.class, callback.getContext());
-							if (filterValue instanceof String) {
-								filter.setValue((String) filterValue);
-							} else if (filterValue instanceof List) {
-								List<?> idList = (List<?>) filterValue;
-								filter.setValue(QueryConfigUtils
-										.listToCsv(idList));
-							}
-						}
-					}
-
-					if (biomartQuery.getQuery().getFormatter() == null) {
-						if (STREAM_RESULTS) {
-							final List<Attribute> attributes = biomartQuery
-									.getAttributesInLinkOrder();
-							final Map<String, List<T2Reference>> outputLists = new HashMap<String, List<T2Reference>>();
-							for (Attribute attribute : attributes) {
-								outputLists.put(attribute.getQualifiedName(),
-										new ArrayList<T2Reference>());
-							}
-
-							biomartQuery.getMartService().executeQuery(query,
-									new ResultReceiver() {
-
-										public void receiveResult(
-												Object[] resultLine, long index) throws ResultReceiverException {
-											Map<String, T2Reference> partialOutputData = new HashMap<String, T2Reference>();
-											for (int i = 0; i < resultLine.length; i++) {
-												Attribute attribute = attributes
-														.get(i);
-												String outputName = attribute
-														.getQualifiedName();
-												Integer outputDepth = getOutputPortDepth(outputName);
-                                                if (outputDepth == null) {
-                                                    logger.warn("Skipping unknown output port " + outputName);
-                                                    continue;
-                                                }
-												try {
-													T2Reference data = referenceService
-															.register(resultLine[i], outputDepth - 1, true, callback.getContext());
-													partialOutputData.put(
-															outputName, data);
-													outputLists.get(outputName)
-															.add((int) index, data);
-												} catch (ReferenceServiceException e) {
-													throw new ResultReceiverException(e);
-//													callback.fail("Failure when calling the reference service", e);
-												}
-											}
-											callback.receiveResult(
-													partialOutputData,
-													new int[] { (int) index });
-										}
-
-										public void receiveError(String message,
-												long index) throws ResultReceiverException {
-											Map<String, T2Reference> partialOutputData = new HashMap<String, T2Reference>();
-											for (Attribute attribute : attributes) {
-												String outputName = attribute
-														.getQualifiedName();
-    				                                Integer outputDepth = getOutputPortDepth(outputName);
-    				                                if (outputDepth == null) {
-    				                                    logger.warn("Skipping unknown output port " + outputName);
-    				                                    continue;
-    				                                }
-    				                                try {
-													T2Reference error = referenceService.getErrorDocumentService()
-															.registerError(message, outputDepth - 1, callback.getContext()).getId();
-													partialOutputData.put(
-															outputName, error);
-													outputLists.get(outputName)
-															.add((int) index, error);
-												} catch (ReferenceServiceException e) {
-													throw new ResultReceiverException(e);
-//													callback.fail("Failure when calling the reference service", e);
-												}
-											}
-											callback.receiveResult(
-													partialOutputData,
-													new int[] { (int) index });
-										}
-
-									});
-
-							for (Attribute attribute : attributes) {
-								String outputName = attribute
-										.getQualifiedName();
-								Integer outputDepth = getOutputPortDepth(outputName);
-								if (outputDepth == null) {
-								    logger.warn("Skipping unknown output port " + outputName);
-								    continue;
-								}
-								outputData.put(outputName, referenceService.register(
-										outputLists.get(outputName),
-										outputDepth, true, callback.getContext()));
-							}
-
-						} else {
-							// shouldn't need to reorder attributes for MartJ
-							// 0.5
-							Object[] resultList = biomartQuery.getMartService()
-									.executeQuery(query);
-							List<Attribute> attributes = biomartQuery
-									.getAttributesInLinkOrder();
-							assert resultList.length == attributes.size();
-							for (int i = 0; i < resultList.length; i++) {
-								Attribute attribute = attributes.get(i);
-								String outputName = attribute
-										.getQualifiedName();
-                                Integer outputDepth = getOutputPortDepth(outputName);
-                                if (outputDepth == null) {
-                                    logger.warn("Skipping unknown output port " + outputName);
-                                } else {
-                                    outputData.put(outputName, referenceService.register(
-										resultList[i], outputDepth, true, callback.getContext()));
-                                }
-							}
-						}
-					} else {
-						Object[] resultList = biomartQuery.getMartService()
-								.executeQuery(query);
-						assert resultList.length == 1;
-						Dataset dataset = biomartQuery.getQuery().getDatasets()
-								.get(0);
-						String outputName = dataset.getName();
-                        Integer outputDepth = getOutputPortDepth(outputName);
-                        if (outputDepth == null) {
-                            logger.warn("Skipping unknown output port " + outputName);
-                        } else {
-                            outputData.put(outputName, referenceService.register(
-								resultList[0], outputDepth, true, callback.getContext()));
-                        }
-					}
-
-					callback.receiveResult(outputData, new int[0]);
-				} catch (MartServiceException e) {
-					callback.fail("Failure calling biomart", e);
-				} catch (ReferenceServiceException e) {
-					callback.fail("Failure when calling the reference service", e);
-				} catch (ResultReceiverException e) {
-					callback.fail("Failure when receiving a result from biomart", e);
-				}
-			}
-
-		});
-
-	}
-
-	private Integer getOutputPortDepth(String portName) {
-		for (ActivityOutputPort port : getOutputPorts()) {
-			if (port.getName().equals(portName)) {
-				return port.getDepth();
-			}
-		}
-		return null;
-	}
-
-//	private void buildInputPorts(List<Edit<?>> editList) {
-//		Map<String, ActivityInputPort> newInputMap = new HashMap<String, ActivityInputPort>();
-//		List<Filter> filters = biomartQuery.getQuery().getFilters();
-//		// Create new input ports corresponding to filters
-//		for (Filter filter : filters) {
-//			String name = filter.getQualifiedName() + "_filter";
-//			if (inputMap.containsKey(name)) {
-//				newInputMap.put(name, inputMap.remove(name));
-//			} else {
-//				ActivityInputPort inputPort = null;
-//				if (filter.isList()) {
-//					inputPort = edits.createActivityInputPort(name, 1, true,
-//							new ArrayList<Class<? extends ExternalReferenceSPI>>(),
-//							String.class);
-//				} else {
-//					inputPort = edits.createActivityInputPort(name, 0, true,
-//							new ArrayList<Class<? extends ExternalReferenceSPI>>(),
-//							String.class);
-//				}
-//				newInputMap.put(name, inputPort);
-//				editList.add(edits.getAddActivityInputPortEdit(this, inputPort));
-//				editList.add(createAddMimeTypeAnnotationEdit(inputPort, "text/plain"));
-//			}
-//		}
-//		//remove any ports still left in the map
-//		for (ActivityInputPort inputPort : inputMap.values()) {
-//			editList.add(edits.getRemoveActivityInputPortEdit(this, inputPort));
-//		}
-//		inputMap = newInputMap;
-//	}
-
-//	private void buildOutputPorts(List<Edit<?>> editList) {
-//		Map<String, ActivityOutputPort> newOutputMap = new HashMap<String, ActivityOutputPort>();
-//		Query query = biomartQuery.getQuery();
-//		List<Attribute> attributes = query.getAttributes();
-//		String formatter = query.getFormatter();
-//		if (formatter == null) {
-//			// Create new output ports corresponding to attributes
-//			for (Attribute attribute : attributes) {
-//				String name = attribute.getQualifiedName();
-//				if (outputMap.containsKey(name)) {
-//					newOutputMap.put(name, outputMap.remove(name));
-//				} else {
-//					ActivityOutputPort outputPort = null;
-//					if (attribute.getAttributes() != null) {
-//						outputPort = edits.createActivityOutputPort(name, 2, STREAM_RESULTS?1:2);
-//					} else {
-//						outputPort = edits.createActivityOutputPort(name, 1, STREAM_RESULTS?0:1);
-//					}
-//					newOutputMap.put(name, outputPort);
-//					editList.add(edits.getAddActivityOutputPortEdit(this, outputPort));
-//					editList.add(createAddMimeTypeAnnotationEdit(outputPort, "text/plain"));
-//				}
-//			}
-//		} else if (attributes.size() > 0) {
-//			// create one port using the dataset name
-//			Attribute attribute = attributes.get(0);
-//			String name = attribute.getContainingDataset().getName();
-//			if (outputMap.containsKey(name)) {
-//				newOutputMap.put(name, outputMap.remove(name));
-//			} else {
-//				ActivityOutputPort outputPort = edits.createActivityOutputPort(name, 0, 0);
-//				newOutputMap.put(name, outputPort);
-//				editList.add(edits.getAddActivityOutputPortEdit(this, outputPort));
-//				editList.add(createAddMimeTypeAnnotationEdit(outputPort, "text/plain"));
-//			}
-//		}
-//		//remove any ports still left in the map
-//		for (ActivityOutputPort outputPort : outputMap.values()) {
-//			editList.add(edits.getRemoveActivityOutputPortEdit(this, outputPort));
-//		}
-//		outputMap = newOutputMap;
-//	}
-
-//	private Edit<?> createAddMimeTypeAnnotationEdit(Annotated<?> annotated, String type) {
-//		MimeType mimeType = new MimeType();
-//		mimeType.setText(type);
-//		return edits.getAddAnnotationChainEdit(annotated, mimeType);
-//	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityConfigurationBean.java b/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityConfigurationBean.java
deleted file mode 100644
index 91cc323..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityConfigurationBean.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 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.biomart;
-
-import net.sf.taverna.t2.workflowmodel.processor.config.ConfigurationBean;
-import net.sf.taverna.t2.workflowmodel.processor.config.ConfigurationProperty;
-
-import org.jdom.Element;
-
-/**
- * Biomart configuration.
- *
- * @author David Withers
- */
-@ConfigurationBean(uri = BiomartActivity.URI + "#Config")
-public class BiomartActivityConfigurationBean {
-
-	private Element martQuery;
-
-	public Element getMartQuery() {
-		return martQuery;
-	}
-
-	@ConfigurationProperty(name = "martQuery", label = "Mart Query", description = "Biomart query in XML")
-	public void setMartQuery(Element martQuery) {
-		this.martQuery = martQuery;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactory.java b/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactory.java
deleted file mode 100644
index 4aaf043..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactory.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 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.biomart;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
-
-import org.apache.log4j.Logger;
-import org.biomart.martservice.MartQuery;
-import org.biomart.martservice.MartServiceXMLHandler;
-import org.biomart.martservice.query.Attribute;
-import org.biomart.martservice.query.Filter;
-import org.biomart.martservice.query.Query;
-import org.jdom.Document;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * An {@link ActivityFactory} for creating <code>BiomartActivity</code>.
- *
- * @author David Withers
- */
-public class BiomartActivityFactory implements ActivityFactory {
-
-	private static Logger logger = Logger.getLogger(BiomartActivityFactory.class);
-
-	private Edits edits;
-	private SAXBuilder builder = new SAXBuilder();
-
-	@Override
-	public BiomartActivity createActivity() {
-		return new BiomartActivity();
-	}
-
-	@Override
-	public URI getActivityType() {
-		return URI.create(BiomartActivity.URI);
-	}
-
-	@Override
-	public JsonNode getActivityConfigurationSchema() {
-		ObjectMapper objectMapper = new ObjectMapper();
-		try {
-			return objectMapper.readTree(getClass().getResource("/schema.json"));
-		} catch (IOException e) {
-			return objectMapper.createObjectNode();
-		}
-	}
-
-	@Override
-	public Set<ActivityInputPort> getInputPorts(JsonNode configuration) {
-		Set<ActivityInputPort> inputPorts = new HashSet<>();
-		try {
-			Query query = getQuery(configuration);
-			for (Filter filter : query.getFilters()) {
-				String name = filter.getQualifiedName() + "_filter";
-				inputPorts.add(edits.createActivityInputPort(name, filter.isList() ? 1 : 0, true,
-						new ArrayList<Class<? extends ExternalReferenceSPI>>(), String.class));
-			}
-		} catch (JDOMException | IOException e) {
-			logger.warn("Error caluculating input ports from BioMart configuration", e);
-		}
-		return inputPorts;
-	}
-
-	@Override
-	public Set<ActivityOutputPort> getOutputPorts(JsonNode configuration) {
-		Set<ActivityOutputPort> outputPorts = new HashSet<>();
-		try {
-			Query query = getQuery(configuration);
-			List<Attribute> attributes = query.getAttributes();
-			if (query.getFormatter() == null) {
-				// Create new output ports corresponding to attributes
-				for (Attribute attribute : attributes) {
-					String name = attribute.getQualifiedName();
-					ActivityOutputPort outputPort = null;
-					if (attribute.getAttributes() != null) {
-						outputPorts.add(edits.createActivityOutputPort(name, 2,
-								BiomartActivity.STREAM_RESULTS ? 1 : 2));
-					} else {
-						outputPorts.add(edits.createActivityOutputPort(name, 1,
-								BiomartActivity.STREAM_RESULTS ? 0 : 1));
-					}
-				}
-			} else if (attributes.size() > 0) {
-				// create one port using the dataset name
-				Attribute attribute = attributes.get(0);
-				String name = attribute.getContainingDataset().getName();
-				outputPorts.add(edits.createActivityOutputPort(name, 0, 0));
-			}
-		} catch (JDOMException | IOException e) {
-			logger.warn("Error caluculating output ports from BioMart configuration", e);
-		}
-		return outputPorts;
-	}
-
-	public void setEdits(Edits edits) {
-		this.edits = edits;
-	}
-
-	private Query getQuery(JsonNode configuration) throws JDOMException, IOException {
-		String martQueryText = configuration.get("martQuery").asText();
-		Document document = builder.build(new StringReader(martQueryText));
-		MartQuery martQuery = MartServiceXMLHandler.elementToMartQuery(document.getRootElement(),
-				null);
-		return martQuery.getQuery();
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityHealthChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityHealthChecker.java b/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityHealthChecker.java
deleted file mode 100644
index 8e48635..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityHealthChecker.java
+++ /dev/null
@@ -1,76 +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
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomart;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.List;
-
-import net.sf.taverna.t2.visit.VisitReport;
-
-import net.sf.taverna.t2.workflowmodel.health.RemoteHealthChecker;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.DisabledActivity;
-
-
-import org.biomart.martservice.MartQuery;
-import org.biomart.martservice.MartServiceXMLHandler;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-
-public class BiomartActivityHealthChecker extends RemoteHealthChecker {
-
-	public boolean canVisit(Object subject) {
-		if (subject == null) {
-			return false;
-		}
-		if (subject instanceof BiomartActivity) {
-			return true;
-		}
-		if (subject instanceof DisabledActivity) {
-			return (((DisabledActivity) subject).getActivity() instanceof BiomartActivity);
-		}
-		return false;
-	}
-
-	public VisitReport visit(Object o, List<Object> ancestors) {
-		Element biomartQueryElement = null;
-		Activity activity = (Activity) o;
-		if (activity instanceof BiomartActivity) {
-			String martQueryText = ((BiomartActivity)activity).getConfiguration().get("martQuery").asText();
-			SAXBuilder builder = new SAXBuilder();
-			try {
-				Document document = builder.build(new StringReader(martQueryText));
-				biomartQueryElement = document.getRootElement();
-			} catch (JDOMException | IOException e) {
-				e.printStackTrace();
-			}
-		} else if (activity instanceof DisabledActivity) {
-			biomartQueryElement = (Element) ((DisabledActivity) activity).getActivityConfiguration();
-		}
-		MartQuery biomartQuery = MartServiceXMLHandler.elementToMartQuery(biomartQueryElement, null);
-		return contactEndpoint(activity, biomartQuery.getMartService().getLocation());
-	}
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker b/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
deleted file mode 100644
index 19aae39..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
+++ /dev/null
@@ -1 +0,0 @@
-# net.sf.taverna.t2.activities.biomart.BiomartActivityHealthChecker
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/src/main/resources/META-INF/spring/biomart-activity-context-osgi.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/spring/biomart-activity-context-osgi.xml b/src/main/resources/META-INF/spring/biomart-activity-context-osgi.xml
deleted file mode 100644
index d8df086..0000000
--- a/src/main/resources/META-INF/spring/biomart-activity-context-osgi.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?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="biomartActivityHealthChecker" interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
-
-	<service ref="biomartActivityFactory" interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" />
-
-	<reference id="edits" interface="net.sf.taverna.t2.workflowmodel.Edits" />
-
-</beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/src/main/resources/META-INF/spring/biomart-activity-context.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/spring/biomart-activity-context.xml b/src/main/resources/META-INF/spring/biomart-activity-context.xml
deleted file mode 100644
index dcc0538..0000000
--- a/src/main/resources/META-INF/spring/biomart-activity-context.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?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="biomartActivityHealthChecker" class="net.sf.taverna.t2.activities.biomart.BiomartActivityHealthChecker" />
-
-	<bean id="biomartActivityFactory" class="net.sf.taverna.t2.activities.biomart.BiomartActivityFactory">
-		<property name="edits" ref="edits" />
-	</bean>
-
-
-</beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/src/main/resources/schema.json
----------------------------------------------------------------------
diff --git a/src/main/resources/schema.json b/src/main/resources/schema.json
deleted file mode 100644
index 99eb9f2..0000000
--- a/src/main/resources/schema.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-    "$schema": "http://json-schema.org/draft-03/schema#",
-    "id": "http://ns.taverna.org.uk/2010/activity/biomart.schema.json",
-    "title": "Biomart activity configuration",
-    "type": "object",
-    "properties": {
-        "@context": {
-            "description": "JSON-LD context for interpreting the configuration as RDF",
-            "required": true,
-            "enum": ["http://ns.taverna.org.uk/2010/activity/biomart.context.json"]
-        },
-        "martQuery": {
-            "title": "Mart Query",
-            "description": "Biomart query in XML",
-            "type": "string",
-            "required": true,
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/src/test/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactoryTest.java b/src/test/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactoryTest.java
deleted file mode 100644
index 78ed2f6..0000000
--- a/src/test/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactoryTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 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.biomart;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URI;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- *
- * @author David Withers
- */
-public class BiomartActivityFactoryTest {
-
-	private BiomartActivityFactory factory;
-
-	/**
-	 * @throws java.lang.Exception
-	 */
-	@Before
-	public void setUp() throws Exception {
-		factory = new BiomartActivityFactory();
-	}
-
-	/**
-	 * Test method for {@link net.sf.taverna.t2.activities.biomart.BiomartActivityFactory#createActivity()}.
-	 */
-	@Test
-	public void testCreateActivity() {
-		BiomartActivity createActivity = factory.createActivity();
-		assertNotNull(createActivity);
-	}
-
-	/**
-	 * Test method for {@link net.sf.taverna.t2.activities.biomart.BiomartActivityFactory#getActivityType()}.
-	 */
-	@Test
-	public void testGetActivityURI() {
-		assertEquals(URI.create(BiomartActivity.URI), factory.getActivityType());
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/src/test/resources/biomart-query.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/biomart-query.xml b/src/test/resources/biomart-query.xml
deleted file mode 100644
index e0b43bd..0000000
--- a/src/test/resources/biomart-query.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<MartQuery xmlns:biomart="http://org.embl.ebi.escience/xscufl-biomart/0.1alpha">
-  <MartService location="http://www.biomart.org/biomart/martservice" />
-  <MartDataset displayName="Homo sapiens genes (NCBI36)" name="hsapiens_gene_ensembl" type="TableSet" initialBatchSize="100" maximumBatchSize="50000" visible="false">
-    <MartURLLocation default="1" displayName="ENSEMBL 41 (SANGER)" host="www.biomart.org" name="ensembl" port="80" serverVirtualSchema="default" virtualSchema="default" visible="1" />
-  </MartDataset>
-  <Query virtualSchemaName="default" count="0" softwareVersion="0.5">
-    <Dataset name="hsapiens_gene_ensembl">
-      <Attribute name="chromosome_name" />
-      <Attribute name="go_description" />
-      <Filter name="chromosome_name" value="1" />
-      <Filter name="band_end" value="p36.32" />
-      <Filter name="band_start" value="p36.33" />
-    </Dataset>
-  </Query>
-</MartQuery>
-

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/pom.xml b/taverna-biomart-activity/pom.xml
new file mode 100644
index 0000000..2662e59
--- /dev/null
+++ b/taverna-biomart-activity/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>net.sf.taverna</groupId>
+		<artifactId>taverna-parent</artifactId>
+		<version>3.0.1-SNAPSHOT</version>
+	</parent>
+	<groupId>net.sf.taverna.t2.activities</groupId>
+	<version>2.0.1-SNAPSHOT</version>
+	<artifactId>biomart-activity</artifactId>
+	<packaging>bundle</packaging>
+	<name>Taverna 2 Biomart Activity.</name>
+	<dependencies>
+		<dependency>
+			<groupId>org.biomart</groupId>
+			<artifactId>martservice</artifactId>
+			<version>2.0.1-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.taverna.t2.core</groupId>
+			<artifactId>workflowmodel-api</artifactId>
+			<version>${t2.core.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.taverna.t2.core</groupId>
+			<artifactId>reference-api</artifactId>
+			<version>${t2.core.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-databind</artifactId>
+			<version>${jackson-databind.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>${junit.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.taverna.t2.activities</groupId>
+			<artifactId>activity-test-utils</artifactId>
+			<version>${t2.activities.version}</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+
+	<repositories>
+		<repository>
+			<releases />
+			<snapshots>
+				<enabled>false</enabled>
+			</snapshots>
+			<id>mygrid-repository</id>
+			<name>myGrid Repository</name>
+			<url>http://www.mygrid.org.uk/maven/repository</url>
+		</repository>
+		<repository>
+			<releases>
+				<enabled>false</enabled>
+			</releases>
+			<snapshots />
+			<id>mygrid-snapshot-repository</id>
+			<name>myGrid Snapshot Repository</name>
+			<url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
+		</repository>
+	</repositories>
+	<scm>
+		<connection>scm:git:https://github.com/taverna/taverna-biomart-activity.git</connection>
+		<developerConnection>scm:git:ssh://git@github.com/taverna/taverna-biomart-activity.git</developerConnection>
+		<url>https://github.com/taverna/taverna-biomart-activity/</url>
+		<tag>HEAD</tag>
+	</scm>
+</project>
+

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivity.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivity.java b/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivity.java
new file mode 100644
index 0000000..7e87939
--- /dev/null
+++ b/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivity.java
@@ -0,0 +1,351 @@
+/*******************************************************************************
+ * 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.biomart;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.sf.taverna.t2.reference.ReferenceService;
+import net.sf.taverna.t2.reference.ReferenceServiceException;
+import net.sf.taverna.t2.reference.T2Reference;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
+
+import org.apache.log4j.Logger;
+import org.biomart.martservice.MartQuery;
+import org.biomart.martservice.MartServiceException;
+import org.biomart.martservice.MartServiceXMLHandler;
+import org.biomart.martservice.ResultReceiver;
+import org.biomart.martservice.ResultReceiverException;
+import org.biomart.martservice.config.QueryConfigUtils;
+import org.biomart.martservice.query.Attribute;
+import org.biomart.martservice.query.Dataset;
+import org.biomart.martservice.query.Filter;
+import org.biomart.martservice.query.Query;
+import org.jdom.Document;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * An Activity providing Biomart functionality.
+ *
+ * @author David Withers
+ */
+public class BiomartActivity extends AbstractAsynchronousActivity<JsonNode> {
+
+	public static final String URI = "http://ns.taverna.org.uk/2010/activity/biomart";
+
+	static boolean STREAM_RESULTS = true;
+
+	private static Logger logger = Logger.getLogger(BiomartActivity.class);
+	
+	private JsonNode json;
+
+	private MartQuery biomartQuery;
+
+	@Override
+	public void configure(JsonNode json)
+			throws ActivityConfigurationException {
+		this.json = json;
+		String martQueryText = json.get("martQuery").asText();
+		SAXBuilder builder = new SAXBuilder();
+		try {
+			Document document = builder.build(new StringReader(martQueryText));
+			biomartQuery = MartServiceXMLHandler.elementToMartQuery(document.getRootElement(), null);
+		} catch (JDOMException | IOException e) {
+			throw new ActivityConfigurationException(e);
+		}
+	}
+
+	@Override
+	public JsonNode getConfiguration() {
+		return json;
+	}
+
+	@Override
+	public void executeAsynch(final Map<String, T2Reference> data,
+			final AsynchronousActivityCallback callback) {
+		callback.requestRun(new Runnable() {
+
+			public void run() {
+				final ReferenceService referenceService = callback.getContext().getReferenceService();
+
+				final Map<String, T2Reference> outputData = new HashMap<String, T2Reference>();
+
+				try {
+					// Get a query including data source etc, creating
+					// a copy so that any filter value settings are not
+					// overwritten by input values
+					biomartQuery.calculateLinks();
+					Query query = new Query(biomartQuery.getQuery());
+
+					// Configure any filters
+					List<Filter> filters = query.getFilters();
+					for (Filter filter : filters) {
+						String name = filter.getQualifiedName();
+						if (data.containsKey(name + "_filter")) {
+							Object filterValue = referenceService.renderIdentifier(data
+									.get(name + "_filter"), String.class, callback.getContext());
+							if (filterValue instanceof String) {
+								filter.setValue((String) filterValue);
+							} else if (filterValue instanceof List) {
+								List<?> idList = (List<?>) filterValue;
+								filter.setValue(QueryConfigUtils
+										.listToCsv(idList));
+							}
+						}
+					}
+
+					if (biomartQuery.getQuery().getFormatter() == null) {
+						if (STREAM_RESULTS) {
+							final List<Attribute> attributes = biomartQuery
+									.getAttributesInLinkOrder();
+							final Map<String, List<T2Reference>> outputLists = new HashMap<String, List<T2Reference>>();
+							for (Attribute attribute : attributes) {
+								outputLists.put(attribute.getQualifiedName(),
+										new ArrayList<T2Reference>());
+							}
+
+							biomartQuery.getMartService().executeQuery(query,
+									new ResultReceiver() {
+
+										public void receiveResult(
+												Object[] resultLine, long index) throws ResultReceiverException {
+											Map<String, T2Reference> partialOutputData = new HashMap<String, T2Reference>();
+											for (int i = 0; i < resultLine.length; i++) {
+												Attribute attribute = attributes
+														.get(i);
+												String outputName = attribute
+														.getQualifiedName();
+												Integer outputDepth = getOutputPortDepth(outputName);
+                                                if (outputDepth == null) {
+                                                    logger.warn("Skipping unknown output port " + outputName);
+                                                    continue;
+                                                }
+												try {
+													T2Reference data = referenceService
+															.register(resultLine[i], outputDepth - 1, true, callback.getContext());
+													partialOutputData.put(
+															outputName, data);
+													outputLists.get(outputName)
+															.add((int) index, data);
+												} catch (ReferenceServiceException e) {
+													throw new ResultReceiverException(e);
+//													callback.fail("Failure when calling the reference service", e);
+												}
+											}
+											callback.receiveResult(
+													partialOutputData,
+													new int[] { (int) index });
+										}
+
+										public void receiveError(String message,
+												long index) throws ResultReceiverException {
+											Map<String, T2Reference> partialOutputData = new HashMap<String, T2Reference>();
+											for (Attribute attribute : attributes) {
+												String outputName = attribute
+														.getQualifiedName();
+    				                                Integer outputDepth = getOutputPortDepth(outputName);
+    				                                if (outputDepth == null) {
+    				                                    logger.warn("Skipping unknown output port " + outputName);
+    				                                    continue;
+    				                                }
+    				                                try {
+													T2Reference error = referenceService.getErrorDocumentService()
+															.registerError(message, outputDepth - 1, callback.getContext()).getId();
+													partialOutputData.put(
+															outputName, error);
+													outputLists.get(outputName)
+															.add((int) index, error);
+												} catch (ReferenceServiceException e) {
+													throw new ResultReceiverException(e);
+//													callback.fail("Failure when calling the reference service", e);
+												}
+											}
+											callback.receiveResult(
+													partialOutputData,
+													new int[] { (int) index });
+										}
+
+									});
+
+							for (Attribute attribute : attributes) {
+								String outputName = attribute
+										.getQualifiedName();
+								Integer outputDepth = getOutputPortDepth(outputName);
+								if (outputDepth == null) {
+								    logger.warn("Skipping unknown output port " + outputName);
+								    continue;
+								}
+								outputData.put(outputName, referenceService.register(
+										outputLists.get(outputName),
+										outputDepth, true, callback.getContext()));
+							}
+
+						} else {
+							// shouldn't need to reorder attributes for MartJ
+							// 0.5
+							Object[] resultList = biomartQuery.getMartService()
+									.executeQuery(query);
+							List<Attribute> attributes = biomartQuery
+									.getAttributesInLinkOrder();
+							assert resultList.length == attributes.size();
+							for (int i = 0; i < resultList.length; i++) {
+								Attribute attribute = attributes.get(i);
+								String outputName = attribute
+										.getQualifiedName();
+                                Integer outputDepth = getOutputPortDepth(outputName);
+                                if (outputDepth == null) {
+                                    logger.warn("Skipping unknown output port " + outputName);
+                                } else {
+                                    outputData.put(outputName, referenceService.register(
+										resultList[i], outputDepth, true, callback.getContext()));
+                                }
+							}
+						}
+					} else {
+						Object[] resultList = biomartQuery.getMartService()
+								.executeQuery(query);
+						assert resultList.length == 1;
+						Dataset dataset = biomartQuery.getQuery().getDatasets()
+								.get(0);
+						String outputName = dataset.getName();
+                        Integer outputDepth = getOutputPortDepth(outputName);
+                        if (outputDepth == null) {
+                            logger.warn("Skipping unknown output port " + outputName);
+                        } else {
+                            outputData.put(outputName, referenceService.register(
+								resultList[0], outputDepth, true, callback.getContext()));
+                        }
+					}
+
+					callback.receiveResult(outputData, new int[0]);
+				} catch (MartServiceException e) {
+					callback.fail("Failure calling biomart", e);
+				} catch (ReferenceServiceException e) {
+					callback.fail("Failure when calling the reference service", e);
+				} catch (ResultReceiverException e) {
+					callback.fail("Failure when receiving a result from biomart", e);
+				}
+			}
+
+		});
+
+	}
+
+	private Integer getOutputPortDepth(String portName) {
+		for (ActivityOutputPort port : getOutputPorts()) {
+			if (port.getName().equals(portName)) {
+				return port.getDepth();
+			}
+		}
+		return null;
+	}
+
+//	private void buildInputPorts(List<Edit<?>> editList) {
+//		Map<String, ActivityInputPort> newInputMap = new HashMap<String, ActivityInputPort>();
+//		List<Filter> filters = biomartQuery.getQuery().getFilters();
+//		// Create new input ports corresponding to filters
+//		for (Filter filter : filters) {
+//			String name = filter.getQualifiedName() + "_filter";
+//			if (inputMap.containsKey(name)) {
+//				newInputMap.put(name, inputMap.remove(name));
+//			} else {
+//				ActivityInputPort inputPort = null;
+//				if (filter.isList()) {
+//					inputPort = edits.createActivityInputPort(name, 1, true,
+//							new ArrayList<Class<? extends ExternalReferenceSPI>>(),
+//							String.class);
+//				} else {
+//					inputPort = edits.createActivityInputPort(name, 0, true,
+//							new ArrayList<Class<? extends ExternalReferenceSPI>>(),
+//							String.class);
+//				}
+//				newInputMap.put(name, inputPort);
+//				editList.add(edits.getAddActivityInputPortEdit(this, inputPort));
+//				editList.add(createAddMimeTypeAnnotationEdit(inputPort, "text/plain"));
+//			}
+//		}
+//		//remove any ports still left in the map
+//		for (ActivityInputPort inputPort : inputMap.values()) {
+//			editList.add(edits.getRemoveActivityInputPortEdit(this, inputPort));
+//		}
+//		inputMap = newInputMap;
+//	}
+
+//	private void buildOutputPorts(List<Edit<?>> editList) {
+//		Map<String, ActivityOutputPort> newOutputMap = new HashMap<String, ActivityOutputPort>();
+//		Query query = biomartQuery.getQuery();
+//		List<Attribute> attributes = query.getAttributes();
+//		String formatter = query.getFormatter();
+//		if (formatter == null) {
+//			// Create new output ports corresponding to attributes
+//			for (Attribute attribute : attributes) {
+//				String name = attribute.getQualifiedName();
+//				if (outputMap.containsKey(name)) {
+//					newOutputMap.put(name, outputMap.remove(name));
+//				} else {
+//					ActivityOutputPort outputPort = null;
+//					if (attribute.getAttributes() != null) {
+//						outputPort = edits.createActivityOutputPort(name, 2, STREAM_RESULTS?1:2);
+//					} else {
+//						outputPort = edits.createActivityOutputPort(name, 1, STREAM_RESULTS?0:1);
+//					}
+//					newOutputMap.put(name, outputPort);
+//					editList.add(edits.getAddActivityOutputPortEdit(this, outputPort));
+//					editList.add(createAddMimeTypeAnnotationEdit(outputPort, "text/plain"));
+//				}
+//			}
+//		} else if (attributes.size() > 0) {
+//			// create one port using the dataset name
+//			Attribute attribute = attributes.get(0);
+//			String name = attribute.getContainingDataset().getName();
+//			if (outputMap.containsKey(name)) {
+//				newOutputMap.put(name, outputMap.remove(name));
+//			} else {
+//				ActivityOutputPort outputPort = edits.createActivityOutputPort(name, 0, 0);
+//				newOutputMap.put(name, outputPort);
+//				editList.add(edits.getAddActivityOutputPortEdit(this, outputPort));
+//				editList.add(createAddMimeTypeAnnotationEdit(outputPort, "text/plain"));
+//			}
+//		}
+//		//remove any ports still left in the map
+//		for (ActivityOutputPort outputPort : outputMap.values()) {
+//			editList.add(edits.getRemoveActivityOutputPortEdit(this, outputPort));
+//		}
+//		outputMap = newOutputMap;
+//	}
+
+//	private Edit<?> createAddMimeTypeAnnotationEdit(Annotated<?> annotated, String type) {
+//		MimeType mimeType = new MimeType();
+//		mimeType.setText(type);
+//		return edits.getAddAnnotationChainEdit(annotated, mimeType);
+//	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityConfigurationBean.java b/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityConfigurationBean.java
new file mode 100644
index 0000000..91cc323
--- /dev/null
+++ b/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityConfigurationBean.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (C) 2011 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.biomart;
+
+import net.sf.taverna.t2.workflowmodel.processor.config.ConfigurationBean;
+import net.sf.taverna.t2.workflowmodel.processor.config.ConfigurationProperty;
+
+import org.jdom.Element;
+
+/**
+ * Biomart configuration.
+ *
+ * @author David Withers
+ */
+@ConfigurationBean(uri = BiomartActivity.URI + "#Config")
+public class BiomartActivityConfigurationBean {
+
+	private Element martQuery;
+
+	public Element getMartQuery() {
+		return martQuery;
+	}
+
+	@ConfigurationProperty(name = "martQuery", label = "Mart Query", description = "Biomart query in XML")
+	public void setMartQuery(Element martQuery) {
+		this.martQuery = martQuery;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactory.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactory.java b/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactory.java
new file mode 100644
index 0000000..4aaf043
--- /dev/null
+++ b/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactory.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (C) 2011 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.biomart;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import net.sf.taverna.t2.reference.ExternalReferenceSPI;
+import net.sf.taverna.t2.workflowmodel.Edit;
+import net.sf.taverna.t2.workflowmodel.Edits;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
+
+import org.apache.log4j.Logger;
+import org.biomart.martservice.MartQuery;
+import org.biomart.martservice.MartServiceXMLHandler;
+import org.biomart.martservice.query.Attribute;
+import org.biomart.martservice.query.Filter;
+import org.biomart.martservice.query.Query;
+import org.jdom.Document;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * An {@link ActivityFactory} for creating <code>BiomartActivity</code>.
+ *
+ * @author David Withers
+ */
+public class BiomartActivityFactory implements ActivityFactory {
+
+	private static Logger logger = Logger.getLogger(BiomartActivityFactory.class);
+
+	private Edits edits;
+	private SAXBuilder builder = new SAXBuilder();
+
+	@Override
+	public BiomartActivity createActivity() {
+		return new BiomartActivity();
+	}
+
+	@Override
+	public URI getActivityType() {
+		return URI.create(BiomartActivity.URI);
+	}
+
+	@Override
+	public JsonNode getActivityConfigurationSchema() {
+		ObjectMapper objectMapper = new ObjectMapper();
+		try {
+			return objectMapper.readTree(getClass().getResource("/schema.json"));
+		} catch (IOException e) {
+			return objectMapper.createObjectNode();
+		}
+	}
+
+	@Override
+	public Set<ActivityInputPort> getInputPorts(JsonNode configuration) {
+		Set<ActivityInputPort> inputPorts = new HashSet<>();
+		try {
+			Query query = getQuery(configuration);
+			for (Filter filter : query.getFilters()) {
+				String name = filter.getQualifiedName() + "_filter";
+				inputPorts.add(edits.createActivityInputPort(name, filter.isList() ? 1 : 0, true,
+						new ArrayList<Class<? extends ExternalReferenceSPI>>(), String.class));
+			}
+		} catch (JDOMException | IOException e) {
+			logger.warn("Error caluculating input ports from BioMart configuration", e);
+		}
+		return inputPorts;
+	}
+
+	@Override
+	public Set<ActivityOutputPort> getOutputPorts(JsonNode configuration) {
+		Set<ActivityOutputPort> outputPorts = new HashSet<>();
+		try {
+			Query query = getQuery(configuration);
+			List<Attribute> attributes = query.getAttributes();
+			if (query.getFormatter() == null) {
+				// Create new output ports corresponding to attributes
+				for (Attribute attribute : attributes) {
+					String name = attribute.getQualifiedName();
+					ActivityOutputPort outputPort = null;
+					if (attribute.getAttributes() != null) {
+						outputPorts.add(edits.createActivityOutputPort(name, 2,
+								BiomartActivity.STREAM_RESULTS ? 1 : 2));
+					} else {
+						outputPorts.add(edits.createActivityOutputPort(name, 1,
+								BiomartActivity.STREAM_RESULTS ? 0 : 1));
+					}
+				}
+			} else if (attributes.size() > 0) {
+				// create one port using the dataset name
+				Attribute attribute = attributes.get(0);
+				String name = attribute.getContainingDataset().getName();
+				outputPorts.add(edits.createActivityOutputPort(name, 0, 0));
+			}
+		} catch (JDOMException | IOException e) {
+			logger.warn("Error caluculating output ports from BioMart configuration", e);
+		}
+		return outputPorts;
+	}
+
+	public void setEdits(Edits edits) {
+		this.edits = edits;
+	}
+
+	private Query getQuery(JsonNode configuration) throws JDOMException, IOException {
+		String martQueryText = configuration.get("martQuery").asText();
+		Document document = builder.build(new StringReader(martQueryText));
+		MartQuery martQuery = MartServiceXMLHandler.elementToMartQuery(document.getRootElement(),
+				null);
+		return martQuery.getQuery();
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityHealthChecker.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityHealthChecker.java b/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityHealthChecker.java
new file mode 100644
index 0000000..8e48635
--- /dev/null
+++ b/taverna-biomart-activity/src/main/java/net/sf/taverna/t2/activities/biomart/BiomartActivityHealthChecker.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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.biomart;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.List;
+
+import net.sf.taverna.t2.visit.VisitReport;
+
+import net.sf.taverna.t2.workflowmodel.health.RemoteHealthChecker;
+import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
+import net.sf.taverna.t2.workflowmodel.processor.activity.DisabledActivity;
+
+
+import org.biomart.martservice.MartQuery;
+import org.biomart.martservice.MartServiceXMLHandler;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+
+public class BiomartActivityHealthChecker extends RemoteHealthChecker {
+
+	public boolean canVisit(Object subject) {
+		if (subject == null) {
+			return false;
+		}
+		if (subject instanceof BiomartActivity) {
+			return true;
+		}
+		if (subject instanceof DisabledActivity) {
+			return (((DisabledActivity) subject).getActivity() instanceof BiomartActivity);
+		}
+		return false;
+	}
+
+	public VisitReport visit(Object o, List<Object> ancestors) {
+		Element biomartQueryElement = null;
+		Activity activity = (Activity) o;
+		if (activity instanceof BiomartActivity) {
+			String martQueryText = ((BiomartActivity)activity).getConfiguration().get("martQuery").asText();
+			SAXBuilder builder = new SAXBuilder();
+			try {
+				Document document = builder.build(new StringReader(martQueryText));
+				biomartQueryElement = document.getRootElement();
+			} catch (JDOMException | IOException e) {
+				e.printStackTrace();
+			}
+		} else if (activity instanceof DisabledActivity) {
+			biomartQueryElement = (Element) ((DisabledActivity) activity).getActivityConfiguration();
+		}
+		MartQuery biomartQuery = MartServiceXMLHandler.elementToMartQuery(biomartQueryElement, null);
+		return contactEndpoint(activity, biomartQuery.getMartService().getLocation());
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker b/taverna-biomart-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
new file mode 100644
index 0000000..19aae39
--- /dev/null
+++ b/taverna-biomart-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
@@ -0,0 +1 @@
+# net.sf.taverna.t2.activities.biomart.BiomartActivityHealthChecker
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/src/main/resources/META-INF/spring/biomart-activity-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/src/main/resources/META-INF/spring/biomart-activity-context-osgi.xml b/taverna-biomart-activity/src/main/resources/META-INF/spring/biomart-activity-context-osgi.xml
new file mode 100644
index 0000000..d8df086
--- /dev/null
+++ b/taverna-biomart-activity/src/main/resources/META-INF/spring/biomart-activity-context-osgi.xml
@@ -0,0 +1,15 @@
+<?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="biomartActivityHealthChecker" interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
+
+	<service ref="biomartActivityFactory" interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" />
+
+	<reference id="edits" interface="net.sf.taverna.t2.workflowmodel.Edits" />
+
+</beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/src/main/resources/META-INF/spring/biomart-activity-context.xml
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/src/main/resources/META-INF/spring/biomart-activity-context.xml b/taverna-biomart-activity/src/main/resources/META-INF/spring/biomart-activity-context.xml
new file mode 100644
index 0000000..dcc0538
--- /dev/null
+++ b/taverna-biomart-activity/src/main/resources/META-INF/spring/biomart-activity-context.xml
@@ -0,0 +1,13 @@
+<?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="biomartActivityHealthChecker" class="net.sf.taverna.t2.activities.biomart.BiomartActivityHealthChecker" />
+
+	<bean id="biomartActivityFactory" class="net.sf.taverna.t2.activities.biomart.BiomartActivityFactory">
+		<property name="edits" ref="edits" />
+	</bean>
+
+
+</beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/src/main/resources/schema.json
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/src/main/resources/schema.json b/taverna-biomart-activity/src/main/resources/schema.json
new file mode 100644
index 0000000..99eb9f2
--- /dev/null
+++ b/taverna-biomart-activity/src/main/resources/schema.json
@@ -0,0 +1,19 @@
+{
+    "$schema": "http://json-schema.org/draft-03/schema#",
+    "id": "http://ns.taverna.org.uk/2010/activity/biomart.schema.json",
+    "title": "Biomart activity configuration",
+    "type": "object",
+    "properties": {
+        "@context": {
+            "description": "JSON-LD context for interpreting the configuration as RDF",
+            "required": true,
+            "enum": ["http://ns.taverna.org.uk/2010/activity/biomart.context.json"]
+        },
+        "martQuery": {
+            "title": "Mart Query",
+            "description": "Biomart query in XML",
+            "type": "string",
+            "required": true,
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/src/test/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactoryTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/src/test/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactoryTest.java b/taverna-biomart-activity/src/test/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactoryTest.java
new file mode 100644
index 0000000..78ed2f6
--- /dev/null
+++ b/taverna-biomart-activity/src/test/java/net/sf/taverna/t2/activities/biomart/BiomartActivityFactoryTest.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (C) 2011 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.biomart;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author David Withers
+ */
+public class BiomartActivityFactoryTest {
+
+	private BiomartActivityFactory factory;
+
+	/**
+	 * @throws java.lang.Exception
+	 */
+	@Before
+	public void setUp() throws Exception {
+		factory = new BiomartActivityFactory();
+	}
+
+	/**
+	 * Test method for {@link net.sf.taverna.t2.activities.biomart.BiomartActivityFactory#createActivity()}.
+	 */
+	@Test
+	public void testCreateActivity() {
+		BiomartActivity createActivity = factory.createActivity();
+		assertNotNull(createActivity);
+	}
+
+	/**
+	 * Test method for {@link net.sf.taverna.t2.activities.biomart.BiomartActivityFactory#getActivityType()}.
+	 */
+	@Test
+	public void testGetActivityURI() {
+		assertEquals(URI.create(BiomartActivity.URI), factory.getActivityType());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/24c4d3c6/taverna-biomart-activity/src/test/resources/biomart-query.xml
----------------------------------------------------------------------
diff --git a/taverna-biomart-activity/src/test/resources/biomart-query.xml b/taverna-biomart-activity/src/test/resources/biomart-query.xml
new file mode 100644
index 0000000..e0b43bd
--- /dev/null
+++ b/taverna-biomart-activity/src/test/resources/biomart-query.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<MartQuery xmlns:biomart="http://org.embl.ebi.escience/xscufl-biomart/0.1alpha">
+  <MartService location="http://www.biomart.org/biomart/martservice" />
+  <MartDataset displayName="Homo sapiens genes (NCBI36)" name="hsapiens_gene_ensembl" type="TableSet" initialBatchSize="100" maximumBatchSize="50000" visible="false">
+    <MartURLLocation default="1" displayName="ENSEMBL 41 (SANGER)" host="www.biomart.org" name="ensembl" port="80" serverVirtualSchema="default" virtualSchema="default" visible="1" />
+  </MartDataset>
+  <Query virtualSchemaName="default" count="0" softwareVersion="0.5">
+    <Dataset name="hsapiens_gene_ensembl">
+      <Attribute name="chromosome_name" />
+      <Attribute name="go_description" />
+      <Filter name="chromosome_name" value="1" />
+      <Filter name="band_end" value="p36.32" />
+      <Filter name="band_start" value="p36.33" />
+    </Dataset>
+  </Query>
+</MartQuery>
+