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 21:44:34 UTC

[14/16] incubator-taverna-plugin-bioinformatics git commit: temporarily empty repository

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartService.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartService.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartService.java
deleted file mode 100644
index c02bbb5..0000000
--- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartService.java
+++ /dev/null
@@ -1,709 +0,0 @@
-/*
- * 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: MartService.java,v $errors/failure.html
- * Revision           $Revision: 1.7 $
- * Release status     $State: Exp $
- * Last modified on   $Date: 2008/08/11 12:48:29 $
- *               by   $Author: davidwithers $
- * Created on 17-Mar-2006
- *****************************************************************/
-package org.biomart.martservice;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.ref.SoftReference;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-
-import org.apache.log4j.Logger;
-import org.biomart.martservice.query.Query;
-import org.ensembl.mart.lib.config.ConfigurationException;
-import org.ensembl.mart.lib.config.DatasetConfig;
-import org.ensembl.mart.lib.config.DatasetConfigXMLUtils;
-import org.ensembl.mart.lib.config.Exportable;
-import org.ensembl.mart.lib.config.Importable;
-import org.jdom.Document;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-import org.xml.sax.InputSource;
-
-/**
- * A class for interacting with a BioMart web service.
- * 
- * @author David Withers
- */
-public class MartService {
-	private static Logger logger = Logger.getLogger(MartServiceUtils.class);
-
-	private String location;
-
-	private String requestId;
-
-	private File cacheDirectory;
-
-	private MartRegistry registry;
-
-	private Map<MartURLLocation, String> versionMap = new HashMap<MartURLLocation, String>();
-
-	private Map<String, MartDataset[]> datasetsMap = new HashMap<String, MartDataset[]>();
-
-	private Map<String, SoftReference<DatasetConfig>> datasetConfigMap = new HashMap<String, SoftReference<DatasetConfig>>();
-
-	private Map<String, Importable[]> importablesMap = new HashMap<String, Importable[]>();
-
-	private Map<String, Exportable[]> exportablesMap = new HashMap<String, Exportable[]>();
-
-	private Map<MartDataset, List<DatasetLink>> linkableDatasetsMap = new HashMap<MartDataset, List<DatasetLink>>();
-
-	private Map<MartDataset, Set<DatasetLink>> datasetToLinkSetMap = new HashMap<MartDataset, Set<DatasetLink>>();
-
-	private Map<MartDataset, Map<MartDataset, MartDataset>> datasetsToPathMap = new HashMap<MartDataset, Map<MartDataset, MartDataset>>();
-
-	private static final Map<String, MartService> martServiceMap = new HashMap<String, MartService>();
-
-	private static final String fs = System.getProperty("file.separator");
-
-	private boolean linksCalculated = false;
-
-	/**
-	 * Constructs an instance of a <code>MartService</code> with the specified
-	 * location.
-	 * 
-	 * The location must be the URL of a valid BioMart MartService, e.g.
-	 * http://www.biomart.org/biomart/martservice
-	 * 
-	 * @param location
-	 *            the URL of the MartService
-	 */
-	private MartService(String location) {
-		this.location = location;
-	}
-
-	/**
-	 * Returns a <code>MartService</code> for the specified location. If a
-	 * <code>MartService</code> does not exist for the location a new one is
-	 * constructed.
-	 * 
-	 * The location must be the URL of a valid BioMart MartService, e.g.
-	 * http://www.biomart.org/biomart/martservice
-	 * 
-	 * @param location
-	 *            the URL of the MartService
-	 */
-	public static MartService getMartService(String location) {
-		if (!martServiceMap.containsKey(location)) {
-			martServiceMap.put(location, new MartService(location));
-		}
-		return martServiceMap.get(location);
-	}
-
-	/**
-	 * Returns the requestId.
-	 * 
-	 * @return the requestId
-	 */
-	public String getRequestId() {
-		return requestId;
-	}
-
-	/**
-	 * Sets the requestId.
-	 * 
-	 * @param requestId
-	 *            the new requestId
-	 */
-	public void setRequestId(String requestId) {
-		this.requestId = requestId;
-	}
-
-	/**
-	 * Returns the cacheDirectory.
-	 * 
-	 * @return the cacheDirectory
-	 */
-	public File getCacheDirectory() {
-		return cacheDirectory;
-	}
-
-	/**
-	 * Sets the cacheDirectory.
-	 * 
-	 * @param cacheDirectory
-	 *            the new cacheDirectory
-	 */
-	public void setCacheDirectory(File cacheDirectory) {
-		this.cacheDirectory = cacheDirectory;
-	}
-
-	/**
-	 * Returns the URL of the MartService.
-	 * 
-	 * @return the URL of the MartService
-	 */
-	public String getLocation() {
-		return location;
-	}
-
-	/**
-	 * Removes any cached items.
-	 */
-	public void clearCache() {
-		registry = null;
-		datasetsMap.clear();
-		datasetConfigMap.clear();
-		importablesMap.clear();
-		exportablesMap.clear();
-	}
-
-	/**
-	 * Returns the MartRegistry for this MartService.
-	 * 
-	 * @return the MartRegistry for this MartService
-	 * @throws MartServiceException
-	 *             if the MartService returns an error or is unavailable
-	 */
-	public MartRegistry getRegistry() throws MartServiceException {
-		if (registry == null) {
-			registry = MartServiceUtils.getRegistry(location, requestId);
-		}
-		return registry;
-	}
-
-	public String getVersion(MartURLLocation martURLLocation)
-			throws MartServiceException {
-		if (!versionMap.containsKey(martURLLocation)) {
-			versionMap.put(martURLLocation, MartServiceUtils.getVersion(
-					location, requestId, martURLLocation));
-		}
-		return versionMap.get(martURLLocation);
-	}
-
-	/**
-	 * Returns all the datasets available from this MartService.
-	 * 
-	 * @return all the datasets available from this MartService.
-	 * @throws MartServiceException
-	 *             if the MartService returns an error or is unavailable
-	 */
-	public MartDataset[] getDatasets() throws MartServiceException {
-		List<MartDataset> datasets = new ArrayList<MartDataset>();
-		MartURLLocation[] locations = getRegistry().getMartURLLocations();
-		for (int i = 0; i < locations.length; i++) {
-			datasets.addAll(Arrays.asList(getDatasets(locations[i])));
-		}
-		return datasets.toArray(new MartDataset[datasets.size()]);
-	}
-
-	/**
-	 * Returns the datasets belonging to the virtualSchema.
-	 * 
-	 * @param virtualSchema
-	 *            the virtual schema to include datasets from.
-	 * @return the datasets belonging to the virtualSchema.
-	 * @throws MartServiceException
-	 *             if the MartService returns an error or is unavailable
-	 */
-	public MartDataset[] getDatasets(String virtualSchema)
-			throws MartServiceException {
-		List<MartDataset> datasets = new ArrayList<MartDataset>();
-		MartURLLocation[] locations = getRegistry().getMartURLLocations();
-		for (int i = 0; i < locations.length; i++) {
-			if (virtualSchema == null
-					|| virtualSchema.equals(locations[i].getVirtualSchema())) {
-				datasets.addAll(Arrays.asList(getDatasets(locations[i])));
-			}
-		}
-		return datasets.toArray(new MartDataset[datasets.size()]);
-	}
-
-	/**
-	 * Returns the datasets specified by martURLLocation.
-	 * 
-	 * @param martURLLocation
-	 *            where to find the datasets.
-	 * @return the datasets specified by martURLLocation.
-	 * @throws MartServiceException
-	 *             if the MartService returns an error or is unavailable
-	 */
-	public MartDataset[] getDatasets(MartURLLocation martURLLocation)
-			throws MartServiceException {
-		String name = martURLLocation.getName();
-		if (!datasetsMap.containsKey(name)) {
-			datasetsMap.put(name, MartServiceUtils.getDatasets(location,
-					requestId, martURLLocation));
-		}
-		return datasetsMap.get(name);
-	}
-
-	/**
-	 * Returns the dataset specified by a virtualSchema and a dataset name.
-	 * 
-	 * @param virtualSchema
-	 *            the virtualSchema containing the dataset
-	 * @param datasetName
-	 *            the name of the dataset to return
-	 * @return a dataset
-	 * @throws MartServiceException
-	 *             if the MartService returns an error or is unavailable
-	 */
-	public MartDataset getDataset(String virtualSchema, String datasetName)
-			throws MartServiceException {
-		MartDataset result = null;
-		MartDataset[] datasets = getDatasets(virtualSchema);
-		for (int i = 0; i < datasets.length; i++) {
-			if (datasetName.equals(datasets[i].getName())) {
-				result = datasets[i];
-				break;
-			}
-		}
-		return result;
-	}
-
-	/**
-	 * Returns the configuration for a dataset.
-	 * 
-	 * @param dataset
-	 *            the dataset to get the configuration for
-	 * @return the configuration for a dataset
-	 * @throws MartServiceException
-	 *             if the MartService returns an error or is unavailable
-	 */
-	public DatasetConfig getDatasetConfig(MartDataset dataset)
-			throws MartServiceException {
-		String qualifiedName = dataset.getQualifiedName();
-		DatasetConfig datasetConfig;
-		if (!datasetConfigMap.containsKey(qualifiedName)) {
-			if (dataset.getModified() != null && cacheDirectory != null) {
-				datasetConfig = getDatasetConfigFromCache(dataset);
-			} else {
-				datasetConfig = MartServiceUtils.getDatasetConfig(location,
-						requestId, dataset);
-			}
-			datasetConfigMap.put(qualifiedName,
-					new SoftReference<DatasetConfig>(datasetConfig));
-		} else {
-			datasetConfig = datasetConfigMap.get(qualifiedName).get();
-			if (datasetConfig == null) {
-				if (dataset.getModified() != null && cacheDirectory != null) {
-					datasetConfig = getDatasetConfigFromCache(dataset);
-				} else {
-					datasetConfig = MartServiceUtils.getDatasetConfig(location,
-							requestId, dataset);
-				}
-				datasetConfigMap.put(qualifiedName,
-						new SoftReference<DatasetConfig>(datasetConfig));
-			}
-
-		}
-		return datasetConfig;
-	}
-
-	private DatasetConfig getDatasetConfigFromCache(MartDataset dataset)
-			throws MartServiceException {
-		DatasetConfig datasetConfig = null;
-		MartURLLocation mart = dataset.getMartURLLocation();
-		String path = mart.getHost() + fs + mart.getName() + fs
-				+ mart.getVirtualSchema();
-		File martCacheDir = new File(cacheDirectory, path);
-		martCacheDir.mkdirs();
-		File cache = new File(martCacheDir, dataset.getName() + ".cfg");
-		DatasetConfigXMLUtils datasetConfigXMLUtils = new DatasetConfigXMLUtils(
-				true);
-		if (cache.exists()) {
-			try {
-				SAXBuilder builder = new SAXBuilder();
-				Document doc = builder.build(new InputSource(
-						new GZIPInputStream(new FileInputStream(cache))));
-
-				// Document doc =
-				// datasetConfigXMLUtils.getDocumentForXMLStream(new
-				// FileInputStream(cache));
-
-				datasetConfig = datasetConfigXMLUtils
-						.getDatasetConfigForDocument(doc);
-				datasetConfigXMLUtils.loadDatasetConfigWithDocument(
-						datasetConfig, doc);
-				if (!datasetConfig.getModified().trim().equals(
-						dataset.getModified().trim())) {
-					logger.info(" " + datasetConfig.getModified().trim()
-							+ " != " + dataset.getModified().trim());
-					logger.info("  Database: "
-							+ dataset.getMartURLLocation().getDatabase()
-							+ ", Dataset: " + dataset.getName());
-					datasetConfig = null;
-				}
-			} catch (IOException e) {
-				logger.debug("error reading cache from " + cache.getPath(), e);
-				datasetConfig = null;
-			} catch (ConfigurationException e) {
-				logger.debug("error parsing from " + cache.getPath(), e);
-				datasetConfig = null;
-			} catch (JDOMException e) {
-				logger.debug("error parsing from " + cache.getPath(), e);
-				datasetConfig = null;
-			}
-		}
-		if (datasetConfig == null) {
-			datasetConfig = MartServiceUtils.getDatasetConfig(location,
-					requestId, dataset);
-			try {
-				GZIPOutputStream zipOutputStream = new GZIPOutputStream(
-						new FileOutputStream(cache));
-				datasetConfigXMLUtils.writeDatasetConfigToOutputStream(
-						datasetConfig, zipOutputStream);
-				zipOutputStream.flush();
-				zipOutputStream.close();
-			} catch (IOException e) {
-				logger.debug("error writing cache to " + cache.getPath(), e);
-			} catch (ConfigurationException e) {
-				logger.debug("error writing cache to " + cache.getPath(), e);
-			}
-		}
-		return datasetConfig;
-	}
-
-	/**
-	 * Returns the importables for a dataset.
-	 * 
-	 * @param dataset
-	 * @return the importables for a dataset
-	 * @throws MartServiceException
-	 *             if the MartService returns an error or is unavailable
-	 */
-	public Importable[] getImportables(MartDataset dataset)
-			throws MartServiceException {
-		String qualifiedName = dataset.getQualifiedName();
-		if (!importablesMap.containsKey(qualifiedName)) {
-			try {
-				importablesMap.put(qualifiedName, getDatasetConfig(dataset)
-						.getImportables());
-			} catch (MartServiceException e) {
-				return new Importable[0];
-			}
-		}
-		return importablesMap.get(qualifiedName);
-	}
-
-	/**
-	 * Returns the exportables for a dataset.
-	 * 
-	 * @param dataset
-	 * @return the exportables for a dataset
-	 * @throws MartServiceException
-	 *             if the MartService returns an error or is unavailable
-	 */
-	public Exportable[] getExportables(MartDataset dataset)
-			throws MartServiceException {
-		String qualifiedName = dataset.getQualifiedName();
-		if (!exportablesMap.containsKey(qualifiedName)) {
-			try {
-				exportablesMap.put(qualifiedName, getDatasetConfig(dataset)
-						.getExportables());
-			} catch (MartServiceException e) {
-				return new Exportable[0];
-			}
-		}
-		return exportablesMap.get(qualifiedName);
-	}
-
-	/**
-	 * Sends a <code>Query</code> to the MartService and returns the results
-	 * of executing the query.
-	 * 
-	 * The results are returned as an array of lists; one list for each
-	 * attribute specified in the query.
-	 * 
-	 * @param query
-	 *            the query to execute
-	 * @return the results of executing the query
-	 * @throws MartServiceException
-	 *             if the MartService returns an error or is unavailable
-	 */
-	public Object[] executeQuery(Query query) throws MartServiceException {
-		// logger.info(MartServiceUtils.queryToXML(query));
-		return MartServiceUtils.getResults(location, requestId, query);
-	}
-
-	/**
-	 * Sends a <code>Query</code> to the MartService and writes the results to
-	 * the <code>ResultReceiver</code> as each line of the result stream is
-	 * read.
-	 * 
-	 * @param query
-	 * @param resultReceiver
-	 * @throws MartServiceException
-	 *             if the MartService returns an error or is unavailable
-	 * @throws ResultReceiverException 
-	 *             if the ResultReceiver cannot receive the result
-	 * @see ResultReceiver
-	 */
-	public void executeQuery(Query query, ResultReceiver resultReceiver)
-			throws MartServiceException, ResultReceiverException {
-		MartServiceUtils.putResults(location, requestId, query, resultReceiver);
-	}
-
-	/**
-	 * Returns a list of datasets that can be linked to the specified dataset.
-	 * 
-	 * @param martDataset
-	 * @return datasets that can be linked to the specified dataset
-	 * @throws MartServiceException
-	 */
-	public List<DatasetLink> getLinkableDatasets(MartDataset martDataset)
-			throws MartServiceException {
-		if (!linkableDatasetsMap.containsKey(martDataset)) {
-			List<DatasetLink> linkableDatasets = new ArrayList<DatasetLink>();
-
-			Set<String> importableSet = new HashSet<String>();
-			Importable[] importables = getImportables(martDataset);
-			for (int i = 0; i < importables.length; i++) {
-				importableSet.add(importables[i].getLinkName());
-			}
-
-			MartDataset[] datasets = getDatasets(martDataset.getVirtualSchema());
-			for (int j = 0; j < datasets.length; j++) {
-				if (datasets[j].isVisible()
-						&& !datasets[j].getName().equals(martDataset.getName())) {
-					DatasetLink datasetLink = new DatasetLink(datasets[j],
-							martDataset);
-					Exportable[] exportables = getExportables(datasets[j]);
-					for (int k = 0; k < exportables.length; k++) {
-						String link = exportables[k].getLinkName();
-						if (importableSet.contains(link)) {
-							datasetLink.addLink(link);
-						}
-					}
-					if (datasetLink.hasLinks()) {
-						linkableDatasets.add(datasetLink);
-					}
-				}
-			}
-			linkableDatasetsMap.put(martDataset, linkableDatasets);
-		}
-
-		return linkableDatasetsMap.get(martDataset);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Object#equals(java.lang.Object)
-	 */
-	public boolean equals(Object obj) {
-		boolean result = false;
-		if (obj != null) {
-			MartService other = (MartService) obj;
-			if (location == null) {
-				result = other.location == null;
-			} else {
-				result = location.equals(other.location);
-			}
-		}
-		return result;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Object#hashCode()
-	 */
-	public int hashCode() {
-		return location.hashCode();
-	}
-
-	public boolean linksCalculated() {
-		return linksCalculated;
-	}
-
-	// java implementation of the perl stuff that calculates links.
-	// all this should go for the next version of biomart.
-
-	public void calculateLinks() throws MartServiceException {
-		synchronized (location) {
-			if (!linksCalculated) {
-				datasetToLinkSetMap.clear();
-				datasetsToPathMap.clear();
-
-				MartDataset[] allDatasets = getDatasets();
-				for (int i = 0; i < allDatasets.length; i++) {
-					MartDataset[] datasets = getDatasets(allDatasets[i]
-							.getVirtualSchema());
-					for (int j = 0; j < datasets.length; j++) {
-						if (!allDatasets[i].getName().equals(
-								datasets[j].getName())) {
-							linkDatasets(allDatasets[i], datasets[j]);
-						}
-					}
-				}
-				for (int i = 0; i < allDatasets.length; i++) {
-					datasetsToPathMap.put(allDatasets[i],
-							dijkstra(allDatasets[i]));
-				}
-				linksCalculated = true;
-			}
-		}
-	}
-
-	public List<MartDataset> getPath(MartDataset source, MartDataset target) {
-		List<MartDataset> path = new ArrayList<MartDataset>();
-
-		Map<MartDataset, MartDataset> pathMap = datasetsToPathMap.get(source);
-
-		MartDataset currentDataset = target;
-
-		while (currentDataset != null) {
-			path.add(0, currentDataset);
-			currentDataset = (MartDataset) pathMap.get(currentDataset);
-		}
-
-		if (path.size() < 2 || !path.get(0).equals(source)
-				|| !path.get(path.size() - 1).equals(target)) {
-			return null;
-		}
-
-		return path;
-	}
-
-	public DatasetLink getLinkBetween(MartDataset exportingDataset,
-			MartDataset importingDataset) {
-		Set<DatasetLink> links = datasetToLinkSetMap.get(exportingDataset);
-		for (DatasetLink link : links) {
-			MartDataset targetDataset = link.getTargetDataset();
-			if (importingDataset.equals(targetDataset)) {
-				return link;
-			}
-		}
-
-		return null;
-	}
-
-	public List<DatasetLink> getLinksFrom(MartDataset dataset) {
-		List<DatasetLink> linksFrom = new ArrayList<DatasetLink>();
-		Set<DatasetLink> links = datasetToLinkSetMap.get(dataset);
-		if (links != null) {
-			for (DatasetLink link : links) {
-				if (link.getSourceDataset().equals(dataset)) {
-					linksFrom.add(link);
-				}
-			}
-		}
-		return linksFrom;
-	}
-
-	public void linkDatasets(MartDataset source, MartDataset target)
-			throws MartServiceException {
-		DatasetLink datasetLink = new DatasetLink(source, target);
-		Importable[] importables = getImportables(target);
-		for (int i = 0; i < importables.length; i++) {
-			Exportable[] exportables = getExportables(source);
-			for (int j = 0; j < exportables.length; j++) {
-				if (importables[i].getLinkName().equals(
-						exportables[j].getLinkName())) {
-					String importVersion = importables[i].getLinkVersion();
-					String exportVersion = exportables[j].getLinkVersion();
-					if (importVersion != null && exportVersion != null) {
-						if (importVersion.equals(exportVersion)) {
-							datasetLink.addLink(importables[i].getLinkName());
-						}
-					} else {
-						datasetLink.addLink(importables[i].getLinkName());
-					}
-				}
-			}
-		}
-		if (datasetLink.hasLinks()) {
-			if (!datasetToLinkSetMap.containsKey(source)) {
-				datasetToLinkSetMap.put(source, new HashSet<DatasetLink>());
-			}
-			if (!datasetToLinkSetMap.containsKey(target)) {
-				datasetToLinkSetMap.put(target, new HashSet<DatasetLink>());
-			}
-			datasetToLinkSetMap.get(source).add(datasetLink);
-			datasetToLinkSetMap.get(target).add(datasetLink);
-		}
-	}
-
-	public Map<MartDataset, MartDataset> dijkstra(MartDataset dataset)
-			throws MartServiceException {
-		Map<MartDataset, MartDataset> path = new HashMap<MartDataset, MartDataset>();
-		LinkedList<MartDataset> vertices = new LinkedList<MartDataset>(Arrays
-				.asList(getDatasets(dataset.getVirtualSchema())));
-		Map<MartDataset, Integer> dist = new HashMap<MartDataset, Integer>();
-		for (MartDataset vertex : vertices) {
-			dist.put(vertex, new Integer(10000));
-		}
-
-		dist.put(dataset, new Integer(0));
-
-		while (vertices.size() > 0) {
-			int min_vert_idx = 0;
-			MartDataset min_vert = (MartDataset) vertices.get(min_vert_idx);
-			int min_dist = ((Integer) dist.get(min_vert)).intValue();
-
-			for (int vertex_idx = 0; vertex_idx < vertices.size(); vertex_idx++) {
-				MartDataset vertex = (MartDataset) vertices.get(vertex_idx);
-				if (((Integer) dist.get(vertex)).intValue() < min_dist) {
-					min_vert_idx = vertex_idx;
-					min_vert = vertex;
-					min_dist = ((Integer) dist.get(vertex)).intValue();
-				}
-			}
-
-			if (min_dist == 10000) {
-				// Exhausted a disjoint set of datasets.
-				break;
-			}
-
-			vertices.remove(min_vert_idx);
-
-			List<DatasetLink> edges = getLinksFrom(min_vert);
-			for (DatasetLink edge : edges) {
-				MartDataset vertex = edge.getTargetDataset();
-
-				if (((Integer) dist.get(vertex)).intValue() > ((Integer) dist
-						.get(min_vert)).intValue() + 1) {
-					dist.put(vertex, new Integer(((Integer) dist.get(min_vert))
-							.intValue() + 1));
-					path.put(vertex, min_vert);
-				}
-			}
-		}
-
-		return path;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceException.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceException.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceException.java
deleted file mode 100644
index f1f0639..0000000
--- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceException.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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: MartServiceException.java,v $
- * Revision           $Revision: 1.1 $
- * Release status     $State: Exp $
- * Last modified on   $Date: 2007/01/31 14:12:05 $
- *               by   $Author: davidwithers $
- * Created on 05-May-2006
- *****************************************************************/
-package org.biomart.martservice;
-
-/**
- * Thrown when a MartService is inaccessable or returns an error.
- * 
- * @author David Withers
- */
-public class MartServiceException extends Exception {
-	private static final long serialVersionUID = 5535008907746588537L;
-
-	/**
-	 * Constructs a new exception with no detail message.
-	 * 
-	 */
-	public MartServiceException() {
-		super();
-	}
-
-	/**
-	 * Constructs a new exception with the specified detail message.
-	 * 
-	 * @param message
-	 *            the detail message
-	 * @param cause
-	 *            the cause (a null value is permitted, and indicates that the
-	 *            cause is nonexistent or unknown)
-	 */
-	public MartServiceException(String message, Throwable cause) {
-		super(message, cause);
-	}
-
-	/**
-	 * Constructs a new exception with the specified detail message and cause.
-	 * 
-	 * @param message
-	 *            the detail message
-	 */
-	public MartServiceException(String message) {
-		super(message);
-	}
-
-	/**
-	 * Constructs a new exception with the specified cause.
-	 * 
-	 * @param cause
-	 *            the cause (a null value is permitted, and indicates that the
-	 *            cause is nonexistent or unknown)
-	 */
-	public MartServiceException(Throwable cause) {
-		super(cause);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceUtils.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceUtils.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceUtils.java
deleted file mode 100644
index cdcb400..0000000
--- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceUtils.java
+++ /dev/null
@@ -1,725 +0,0 @@
-/*
- * 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: MartServiceUtils.java,v $
- * Revision           $Revision: 1.12 $
- * Release status     $State: Exp $
- * Last modified on   $Date: 2008/07/31 15:06:49 $
- *               by   $Author: davidwithers $
- * Created on 17-Mar-2006
- *****************************************************************/
-package org.biomart.martservice;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthScope;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.params.HttpMethodParams;
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Logger;
-import org.biomart.martservice.query.Attribute;
-import org.biomart.martservice.query.Dataset;
-import org.biomart.martservice.query.Query;
-import org.biomart.martservice.query.QueryXMLHandler;
-import org.ensembl.mart.lib.config.ConfigurationException;
-import org.ensembl.mart.lib.config.DatasetConfig;
-import org.ensembl.mart.lib.config.DatasetConfigXMLUtils;
-import org.jdom.DocType;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.Namespace;
-import org.jdom.input.SAXBuilder;
-import org.jdom.output.XMLOutputter;
-import org.xml.sax.InputSource;
-
-/**
- * Utility class for interacting with a BioMart web service.
- * 
- * @author David Withers
- */
-public class MartServiceUtils {
-	private static Logger logger = Logger.getLogger(MartServiceUtils.class);
-
-	private static String lineSeparator = System.getProperty("line.separator");
-
-	public static final String QUERY_ATTRIBUTE = "query";
-
-	public static final String DATASET_ATTRIBUTE = "dataset";
-
-	public static final String MART_ATTRIBUTE = "mart";
-
-	public static final String SCHEMA_ATTRIBUTE = "virtualschema";
-
-	public static final String TYPE_ATTRIBUTE = "type";
-
-	public static final String MART_USER_ATTRIBUTE = "martuser";
-
-	public static final String INTERFACE_ATTRIBUTE = "interface";
-
-	public static final String REQUEST_ID_ATTRIBUTE = "requestid";
-
-	public static final String REGISTRY_VALUE = "registry";
-
-	public static final String VERSION_VALUE = "version";
-
-	public static final String DATASETS_VALUE = "datasets";
-
-	public static final String DATASET_VALUE = "dataset";
-
-	public static final String CONFIGURATION_VALUE = "configuration";
-
-	/**
-	 * Sends a registry request to the Biomart webservice and constructs a
-	 * MartRegistry from the XML returned by the webservice.
-	 * 
-	 * @param martServiceLocation
-	 *            the URL of the Biomart webservice
-	 * @return a MartRegistry
-	 * @throws MartServiceException
-	 *             if the Biomart webservice returns an error or is unavailable
-	 */
-	public static MartRegistry getRegistry(String martServiceLocation,
-			String requestId) throws MartServiceException {
-		List<NameValuePair> data = new ArrayList<NameValuePair>();
-		data.add(new NameValuePair(TYPE_ATTRIBUTE, REGISTRY_VALUE));
-		if (requestId != null) {
-			data.add(new NameValuePair(REQUEST_ID_ATTRIBUTE, requestId));
-		}
-		HttpMethod method = new GetMethod(martServiceLocation);
-		method.setQueryString(data
-				.toArray(new NameValuePair[data.size()]));
-		try {
-			InputStream in = executeMethod(method, martServiceLocation);
-			Document document = new SAXBuilder().build(in);
-			Element root = document.getRootElement();
-			return MartServiceXMLHandler.elementToRegistry(root,
-					Namespace.NO_NAMESPACE);
-		} catch (IOException e) {
-			String errorMessage = "Error getting registry from "
-					+ martServiceLocation;
-			throw new MartServiceException(errorMessage, e);
-		} catch (JDOMException e) {
-			String errorMessage = "Error getting registry from "
-					+ martServiceLocation;
-			throw new MartServiceException(errorMessage, e);
-		} finally {
-			method.releaseConnection();
-		}
-
-	}
-
-	public static String getVersion(String martServiceLocation,
-			String requestId, MartURLLocation mart) throws MartServiceException {
-		String errorMessage = "Error getting version from " + martServiceLocation;
-
-		List<NameValuePair> data = new ArrayList<NameValuePair>();
-		data.add(new NameValuePair(TYPE_ATTRIBUTE, VERSION_VALUE));
-		if (mart.getVirtualSchema() != null) {
-			data.add(new NameValuePair(SCHEMA_ATTRIBUTE, mart
-					.getVirtualSchema()));
-		}
-		data.add(new NameValuePair(MART_ATTRIBUTE, mart.getName()));
-		if (requestId != null) {
-			data.add(new NameValuePair(REQUEST_ID_ATTRIBUTE, requestId));
-		}
-		if (requestId != null) {
-			data.add(new NameValuePair(REQUEST_ID_ATTRIBUTE, requestId));
-		}
-		HttpMethod method = new GetMethod(martServiceLocation);
-		method.setQueryString(data
-				.toArray(new NameValuePair[data.size()]));
-		try {
-			InputStream in = executeMethod(method, martServiceLocation);
-			BufferedReader bufferedReader = new BufferedReader(
-					new InputStreamReader(in));
-			String version = bufferedReader.readLine();
-			if (version == null) {
-				throw new MartServiceException(errorMessage + ": No version returned");
-			}
-			version = version.trim();
-			// fix for biomart's 'let's add a blank line' thing
-			if ("".equals(version)) {
-				version = bufferedReader.readLine();
-				if (version == null) {
-					throw new MartServiceException(errorMessage + ": No version returned");
-				}
-				version = version.trim();
-			}
-			bufferedReader.close();
-			return version;
-		} catch (IOException e) {
-			throw new MartServiceException(errorMessage, e);
-		} finally {
-			method.releaseConnection();
-		}
-	}
-
-	/**
-	 * Sends a datasets request to the Biomart webservice and constructs an
-	 * array of MartDataset from the tab separated rows of data returned by the
-	 * webservice.
-	 * 
-	 * @param martServiceLocation
-	 *            the URL of the Biomart webservice
-	 * @param mart
-	 *            the mart to get datasets from
-	 * @return an array of MartDataset
-	 * @throws MartServiceException
-	 *             if the Biomart webservice returns an error or is unavailable
-	 */
-	public static MartDataset[] getDatasets(String martServiceLocation,
-			String requestId, MartURLLocation mart) throws MartServiceException {
-		List<NameValuePair> data = new ArrayList<NameValuePair>();
-		data.add(new NameValuePair(TYPE_ATTRIBUTE, DATASETS_VALUE));
-		if (mart.getVirtualSchema() != null) {
-			data.add(new NameValuePair(SCHEMA_ATTRIBUTE, mart
-					.getVirtualSchema()));
-		}
-		data.add(new NameValuePair(MART_ATTRIBUTE, mart.getName()));
-		if (mart.getMartUser() != null) {
-			data
-					.add(new NameValuePair(MART_USER_ATTRIBUTE, mart
-							.getMartUser()));
-		}
-		if (requestId != null) {
-			data.add(new NameValuePair(REQUEST_ID_ATTRIBUTE, requestId));
-		}
-		HttpMethod method = new GetMethod(martServiceLocation);
-		method.setQueryString(data
-				.toArray(new NameValuePair[data.size()]));
-		try {
-			InputStream in = executeMethod(method, martServiceLocation);
-
-			MartDataset[] datasets = tabSeparatedReaderToDatasets(
-					new InputStreamReader(in), mart);
-			in.close();
-			return datasets;
-		} catch (IOException e) {
-			String errorMessage = "Error getting datasets from "
-					+ martServiceLocation;
-			throw new MartServiceException(errorMessage, e);
-		} finally {
-			method.releaseConnection();
-		}
-	}
-
-	/**
-	 * Sends a configuration request to the Biomart webservice and constructs a
-	 * DatasetConfig from the XML returned by the webservice.
-	 * 
-	 * @param martServiceLocation
-	 *            the URL of the Biomart webservice
-	 * @param dataset
-	 *            the dataset to get the configuration for
-	 * @return a DatasetConfig
-	 * @throws MartServiceException
-	 *             if the Biomart webservice returns an error or is unavailable
-	 */
-	public static DatasetConfig getDatasetConfig(String martServiceLocation,
-			String requestId, MartDataset dataset) throws MartServiceException {
-		List<NameValuePair> data = new ArrayList<NameValuePair>();
-		data.add(new NameValuePair(TYPE_ATTRIBUTE, CONFIGURATION_VALUE));
-		MartURLLocation mart = dataset.getMartURLLocation();
-		// if the dataset has a location specify the virtual schema to uniquely
-		// identify the dataset
-		if (mart != null && mart.getVirtualSchema() != null) {
-			data.add(new NameValuePair(SCHEMA_ATTRIBUTE, mart
-					.getVirtualSchema()));
-		}
-		data.add(new NameValuePair(DATASET_VALUE, dataset.getName()));
-//		if (dataset.getInterface() != null) {
-//			data.add(new NameValuePair(INTERFACE_ATTRIBUTE, dataset
-//					.getInterface()));
-//		}
-		if (mart != null && mart.getMartUser() != null) {
-			data
-					.add(new NameValuePair(MART_USER_ATTRIBUTE, mart
-							.getMartUser()));
-		}
-		if (requestId != null) {
-			data.add(new NameValuePair(REQUEST_ID_ATTRIBUTE, requestId));
-		}
-		HttpMethod method = new GetMethod(martServiceLocation);
-		method.setQueryString(data
-				.toArray(new NameValuePair[data.size()]));
-
-		try {
-			InputStream in = executeMethod(method, martServiceLocation);
-
-			DatasetConfigXMLUtils datasetConfigXMLUtils = new DatasetConfigXMLUtils(
-					true);
-			SAXBuilder builder = new SAXBuilder();
-			Document doc = builder.build(new InputSource(in));
-			// Document doc = datasetConfigXMLUtils.getDocumentForXMLStream(in);
-
-			DatasetConfig datasetConfig = datasetConfigXMLUtils
-					.getDatasetConfigForDocument(doc);
-			datasetConfigXMLUtils.loadDatasetConfigWithDocument(datasetConfig,
-					doc);
-			return datasetConfig;
-		} catch (ConfigurationException e) {
-			String errorMessage = "Error parsing configuration from "
-					+ martServiceLocation;
-			logger.debug(errorMessage, e);
-			throw new MartServiceException(errorMessage, e);
-		} catch (JDOMException e) {
-			String errorMessage = "Error parsing configuration from "
-					+ martServiceLocation;
-			logger.debug(errorMessage, e);
-			throw new MartServiceException(errorMessage, e);
-		} catch (IOException e) {
-			String errorMessage = "Error getting configuration from "
-					+ martServiceLocation;
-			logger.debug(errorMessage, e);
-			throw new MartServiceException(errorMessage, e);
-		} finally {
-			method.releaseConnection();
-		}
-	}
-
-	/**
-	 * Sends a query to the Biomart webservice and constructs an array of List
-	 * of String results from the tab separated rows of data returned by the
-	 * webservice.
-	 * 
-	 * @param martServiceLocation
-	 *            the URL of the Biomart webservice
-	 * @param query
-	 *            the query to send to the webservice
-	 * @return an array of List of String
-	 * @throws MartServiceException
-	 *             if the Biomart webservice returns an error or is unavailable
-	 */
-	public static Object[] getResults(String martServiceLocation,
-			String requestId, Query query) throws MartServiceException {
-		Object[] results = new Object[0];
-		// int attributes = query.getAttributes().size();
-		int attributes = getAttributeCount(query.getAttributes());
-		boolean count = query.getCount() == 1;
-		// if there are no attributes and we're not doing a count there's no
-		// point in doing the query
-		if (attributes > 0 || count) {
-			// The 'new' 0.5 server now resolves the attribute lists so there's
-			// no need to do the split here any more
-			// String queryXml = queryToXML(splitAttributeLists(query));
-			String queryXml = queryToXML(query);
-			logger.info(queryXml);
-			NameValuePair[] data = { new NameValuePair(QUERY_ATTRIBUTE,
-					queryXml) };
-			PostMethod method = new PostMethod(martServiceLocation);
-			method.setRequestBody(data);
-
-			try {
-				InputStream in = executeMethod(method, martServiceLocation);
-				if (query.getFormatter() == null) {
-					results = tabSeparatedReaderToResults(
-							new InputStreamReader(in), count ? 1 : attributes);
-					if (!count) {
-						results = reassembleAttributeLists(results, query);
-					}
-				} else {
-					results = readResult(in, query.getFormatter());
-				}
-				in.close();
-			} catch (IOException e) {
-				String errorMessage = "Error reading data from "
-						+ martServiceLocation;
-				throw new MartServiceException(errorMessage, e);
-			} finally {
-				method.releaseConnection();
-			}
-
-		}
-
-		return results;
-	}
-
-	public static void putResults(String martServiceLocation, String requestId,
-			Query query, ResultReceiver resultReceiver) throws MartServiceException, ResultReceiverException {
-		int attributeCount = getAttributeCount(query.getAttributes());
-		boolean count = query.getCount() == 1;
-		// if there are no attributes and we're not doing a count there's no
-		// point in doing the query
-		if (attributeCount > 0 || count) {
-			String queryXml = queryToXML(query);
-			logger.info(queryXml);
-			NameValuePair[] data = { new NameValuePair(QUERY_ATTRIBUTE,
-					queryXml) };
-			PostMethod method = new PostMethod(martServiceLocation);
-			method.setRequestBody(data);
-
-			try {
-				InputStream in = executeMethod(method, martServiceLocation);
-				if (query.getFormatter() == null) {
-					if (count) {
-						resultReceiver.receiveResult(tabSeparatedReaderToResults(new InputStreamReader(in), 1), 0);
-					} else {
-						List<Attribute> attributes = query.getAttributes();
-						Object[] result = new Object[attributes.size()];
-						BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in));
-						String line = bufferedReader.readLine();
-						for (long i = 0; line != null; line = bufferedReader.readLine(), i++) {
-							String[] tokens = line.split("\t", -1);
-							if (attributeCount == tokens.length) {
-								for (int ri = 0, ti = 0; ri < result.length && ti < tokens.length; ri++) {
-									Attribute attribute = attributes.get(ri);
-									if (attribute.getAttributes() == null) {
-										result[ri] = tokens[ti];
-										ti++;
-									} else {
-										int nestedAttributeCount = attribute.getAttributesCount();
-										List<Object> list = new ArrayList<Object>();
-										for (int j = 0; j < nestedAttributeCount; j++) {
-											list.add(tokens[ti]);
-											ti++;
-										}
-										result[ri] = list;
-									}
-								}
-								resultReceiver.receiveResult(result, i);
-							} else {
-								resultReceiver.receiveError(line, i);
-							}
-						}
-					}
-				} else {
-					resultReceiver.receiveResult(readResult(in, query.getFormatter()), 0);
-				}
-				in.close();
-			} catch (IOException e) {
-				String errorMessage = "Error reading data from "
-						+ martServiceLocation;
-				throw new MartServiceException(errorMessage, e);
-			} finally {
-				method.releaseConnection();
-			}
-
-		}
-	}
-	
-//	private static String getLocation(MartURLLocation martUrlLocation) {
-//		StringBuffer location = new StringBuffer("http://");
-//		location.append(martUrlLocation.getHost());
-//		location.append(":" + martUrlLocation.getPort());
-//		location.append(martUrlLocation.getPath());
-//		return location.toString();
-//	}
-	
-	private static int getAttributeCount(List<Attribute> attributeList) {
-		int result = 0;
-		for (Attribute attribute : attributeList) {
-			if (attribute.getAttributes() == null) {
-				result++;
-			} else {
-				result += attribute.getAttributesCount();
-			}
-		}
-		return result;
-	}
-
-	private static Object[] reassembleAttributeLists(Object[] lists, Query query) {
-		int index = 0;
-		List<Object> result = new ArrayList<Object>();
-		for (Attribute attribute : query.getAttributes()) {
-			if (attribute.getAttributes() == null) {
-				result.add(lists[index]);
-				index++;
-			} else {
-				int attributesCount = attribute.getAttributesCount();
-				List<Object> list = new ArrayList<Object>();
-				for (int i = 0; i < attributesCount; i++) {
-					list.add(lists[index]);
-					index++;
-				}
-				result.add(list);
-			}
-		}
-		return result.toArray();
-	}
-
-	public static Query splitAttributeLists(Query query) {
-		Query result = new Query(query);
-		for (Dataset dataset : result.getDatasets()) {
-			List<Attribute> attributeList = dataset.getAttributes();
-			dataset.removeAllAttributes();
-			for (Attribute attribute : attributeList) {
-				if (attribute.getAttributes() == null) {
-					dataset.addAttribute(attribute);
-				} else {
-					String[] attributes = attribute.getAttributes().split(",");
-					for (int i = 0; i < attributes.length; i++) {
-						dataset.addAttribute(new Attribute(attributes[i]));
-					}
-				}
-			}
-		}
-		return result;
-	}
-
-	public static String getMimeTypeForFormatter(String formatter) {
-		String mimeType = "'text/plain'";
-		if ("ADF".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("AXT".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("AXTPLUS".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("CSV".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("FASTA".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("FASTACDNA".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("GFF".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("HTML".equals(formatter)) {
-			mimeType = "'text/html'";
-		} else if ("MAF".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("MFA".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("MFASTA".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("TSV".equals(formatter)) {
-			mimeType = "'text/tab-separeted-values'";
-		} else if ("TXT".equals(formatter)) {
-			mimeType = "'text/plain'";
-		} else if ("XLS".equals(formatter)) {
-			mimeType = "'application/excel'";
-		}
-		
-		return mimeType;
-	}
-	
-	private static List<String>[] tabSeparatedReaderToResults(Reader reader,
-			int resultsCount) throws IOException {
-		List<String>[] results = new List[resultsCount];
-		for (int i = 0; i < results.length; i++) {
-			results[i] = new ArrayList<String>();
-		}
-		BufferedReader bufferedReader = new BufferedReader(reader);
-		String line = bufferedReader.readLine();
-		while (line != null) {
-			String[] tokens = line.split("\t", -1);
-			for (int i = 0; i < results.length && i < tokens.length; i++) {
-				results[i].add(tokens[i]);
-			}
-			line = bufferedReader.readLine();
-		}
-		return results;
-	}
-
-	private static Object[] readResult(InputStream inputStream, String formatter) throws IOException {
-		Object[] result = new Object[1];
-		
-		if (getMimeTypeForFormatter(formatter).contains("application/")) {
-			result[0] = IOUtils.toByteArray(inputStream);
-		} else {
-			result[0] = IOUtils.toString(inputStream);
-		}
-		return result;
-	}
-	
-	private static MartDataset[] tabSeparatedReaderToDatasets(Reader reader,
-			MartURLLocation martURLLocation) throws IOException {
-		List<MartDataset> datasetList = new ArrayList<MartDataset>();
-		BufferedReader bufferedReader = new BufferedReader(reader);
-		String line = bufferedReader.readLine();
-		while (line != null) {
-			String[] tokens = line.split("\t");
-
-			if (tokens.length >= 7) {
-				MartDataset dataset = new MartDataset();
-
-				dataset.setType(tokens[0]);
-				dataset.setName(tokens[1]);
-				dataset.setDisplayName(tokens[2]);
-				if (tokens[3].equals("1")) {
-					dataset.setVisible(true);
-				} else {
-					dataset.setVisible(false);
-				}
-				// value at position 4 is not documented so it's skipped
-				try {
-					dataset.setInitialBatchSize(Long.parseLong(tokens[5]));
-				} catch (NumberFormatException e) {
-					dataset.setInitialBatchSize(0);
-				}
-				try {
-					dataset.setMaximumBatchSize(Long.parseLong(tokens[6]));
-				} catch (NumberFormatException e) {
-					dataset.setMaximumBatchSize(0);
-				}
-
-				if (tokens.length > 7) {
-					dataset.setInterface(tokens[7]);
-					dataset.setModified(tokens[8]);
-				}
-
-				dataset.setMartURLLocation(martURLLocation);
-
-				datasetList.add(dataset);
-			}
-			line = bufferedReader.readLine();
-		}
-		return datasetList.toArray(new MartDataset[datasetList.size()]);
-	}
-
-	/**
-	 * Creates an XML string from a query
-	 * 
-	 * @param query
-	 * @return an XML string
-	 */
-	public static String queryToXML(Query query) {
-		Document document = new Document(QueryXMLHandler.queryToElement(query,
-				Namespace.NO_NAMESPACE), new DocType("Query"));
-		return new XMLOutputter().outputString(document);
-	}
-
-	/**
-	 * @param martServiceLocation
-	 * @param data
-	 * @return
-	 * @throws MartServiceException
-	 */
-	private static InputStream executeMethod(HttpMethod method,
-			String martServiceLocation) throws MartServiceException {
-		HttpClient client = new HttpClient();
-		if (isProxyHost(martServiceLocation)) {
-			setProxy(client);
-		}
-
-		method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
-				new DefaultHttpMethodRetryHandler(3, false));
-//		method.getParams().setSoTimeout(60000);
-		try {
-			int statusCode = client.executeMethod(method);
-			if (statusCode != HttpStatus.SC_OK) {
-				throw constructException(method, martServiceLocation, null);
-			}
-			return method.getResponseBodyAsStream();
-		} catch (IOException e) {
-			throw constructException(method, martServiceLocation, e);
-		}
-	}
-
-	/**
-	 * 
-	 * @param client
-	 */
-	public static void setProxy(HttpClient client) {
-		String host = System.getProperty("http.proxyHost");
-		String port = System.getProperty("http.proxyPort");
-		String user = System.getProperty("http.proxyUser");
-		String password = System.getProperty("http.proxyPassword");
-
-		if (host != null && port != null) {
-			try {
-				int portInteger = Integer.parseInt(port);
-				client.getHostConfiguration().setProxy(host, portInteger);
-				if (user != null && password != null) {
-					client.getState().setProxyCredentials(
-							new AuthScope(host, portInteger),
-							new UsernamePasswordCredentials(user, password));
-				}
-			} catch (NumberFormatException e) {
-				logger.error("Proxy port not an integer", e);
-			}
-		}
-	}
-
-	public static boolean isProxyHost(String location) {
-		String httpNonProxyHosts = System.getProperty("http.nonProxyHosts");
-		if (httpNonProxyHosts != null) {
-			try {
-				String host = new URL(location).getHost();
-				String[] nonProxyHosts = httpNonProxyHosts.split("\\|");
-				for (int i = 0; i < nonProxyHosts.length; i++) {
-					if (nonProxyHosts[i].startsWith("*")) {
-						if (host.endsWith(nonProxyHosts[i].substring(1))) {
-							return false;
-						}
-					} else if (nonProxyHosts[i].endsWith("*")) {
-						if (host.startsWith(nonProxyHosts[i].substring(0,
-								nonProxyHosts[i].length() - 1))) {
-							return false;
-						}
-					} else {
-						if (host.equals(nonProxyHosts[i])) {
-							return false;
-						}
-					}
-				}
-			} catch (MalformedURLException e) {
-				logger.warn("'" + location + "' is not a valid URL. "
-						+ "Cannot compare host with http.nonProxyHosts", e);
-			}
-		}
-		return true;
-	}
-
-	private static MartServiceException constructException(HttpMethod method,
-			String martServiceLocation, Exception cause) {
-		StringBuffer errorMessage = new StringBuffer();
-		errorMessage.append("Error posting to " + martServiceLocation
-				+ lineSeparator);
-		if (cause == null) {
-			errorMessage.append(" " + method.getStatusLine()
-					+ lineSeparator);
-		}
-		if (method instanceof PostMethod) {
-			PostMethod postMethod = (PostMethod) method;
-			NameValuePair[] data = postMethod.getParameters();
-			for (int i = 0; i < data.length; i++) {
-				errorMessage.append(" " + data[i].getName() + " = "
-						+ data[i].getValue()
-						+ lineSeparator);
-			}
-
-		} else {
-			errorMessage.append(method.getQueryString());
-		}
-		return new MartServiceException(errorMessage.toString(), cause);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceXMLHandler.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceXMLHandler.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceXMLHandler.java
deleted file mode 100644
index e8a5189..0000000
--- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartServiceXMLHandler.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * 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: MartServiceXMLHandler.java,v $
- * Revision           $Revision: 1.4 $
- * Release status     $State: Exp $
- * Last modified on   $Date: 2007/12/13 11:38:55 $
- *               by   $Author: davidwithers $
- * Created on 28-Apr-2006
- *****************************************************************/
-package org.biomart.martservice;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.biomart.martservice.query.QueryXMLHandler;
-import org.jdom.Element;
-import org.jdom.Namespace;
-
-/**
- * Utility class for serializing mart service classes to XML.
- * 
- * @author David Withers
- */
-public class MartServiceXMLHandler {
-	public static final String MART_SERVICE_ELEMENT = "MartService";
-
-	public static final String MART_URL_LOCATION_ELEMENT = "MartURLLocation";
-
-	public static final String MART_DATASET_ELEMENT = "MartDataset";
-
-	public static final String MART_QUERY_ELEMENT = "MartQuery";
-
-	public static final String LINKED_DATASETS_ELEMENT = "LinkedDatasets";
-
-	public static final String LINKED_DATASET_ELEMENT = "LinkedDataset";
-
-	public static final String VIRTUAL_SCHEMA_ELEMENT = "virtualSchema";
-
-	public static final String LOCATION_ATTRIBUTE = "location";
-
-	public static final String DATABASE_ATTRIBUTE = "database";
-
-	public static final String DEFAULT_ATTRIBUTE = "default";
-
-	public static final String DEFAULT_VALUE_ATTRIBUTE = "defaultValue";
-
-	public static final String DISPLAY_NAME_ATTRIBUTE = "displayName";
-
-	public static final String HOST_ATTRIBUTE = "host";
-
-	public static final String INCLUDE_DATASETS_ATTRIBUTE = "includeDatasets";
-
-	public static final String LINK_ATTRIBUTE = "LINK";
-
-	public static final String MART_USER_ATTRIBUTE = "martUser";
-
-	public static final String NAME_ATTRIBUTE = "name";
-
-	public static final String PATH_ATTRIBUTE = "path";
-
-	public static final String PORT_ATTRIBUTE = "port";
-
-	public static final String TYPE_ATTRIBUTE = "type";
-
-	public static final String INITIAL_BATCH_SIZE_ATTRIBUTE = "initialBatchSize";
-
-	public static final String MAXIMUM_BATCH_SIZE_ATTRIBUTE = "maximumBatchSize";
-
-	public static final String VIRTUAL_SCHEMA_ATTRIBUTE = "virtualSchema";
-
-	public static final String SERVER_VIRTUAL_SCHEMA_ATTRIBUTE = "serverVirtualSchema";
-
-	public static final String VISIBLE_ATTRIBUTE = "visible";
-
-	public static final String REDIRECT_ATTRIBUTE = "redirect";
-
-	public static final String INTERFACE_ATTRIBUTE = "interface";
-
-	public static final String MODIFIED_ATTRIBUTE = "modified";
-
-	/**
-	 * Converts a <code>MartService</code> to an XML element.
-	 * 
-	 * @param martService
-	 *            the <code>MartService</code> to serialize
-	 * @param namespace
-	 *            the <code>Namespace</code> to use when constructing the
-	 *            <code>Element</code>
-	 * @return an XML serialization of the <code>MartService</code>
-	 */
-	public static Element martServiceToElement(MartService martService,
-			Namespace namespace) {
-		Element element = new Element(MART_SERVICE_ELEMENT, namespace);
-		element.setAttribute(LOCATION_ATTRIBUTE, martService.getLocation());
-		return element;
-	}
-
-	/**
-	 * Creates a <code>MartService</code> from an XML element.
-	 * 
-	 * @param element
-	 *            the <code>Element</code> to deserialize
-	 * @return a deserialized <code>MartService</code>
-	 */
-	public static MartService elementToMartService(Element element) {
-		return MartService.getMartService(element
-				.getAttributeValue(LOCATION_ATTRIBUTE));
-	}
-
-	/**
-	 * Converts a <code>MartDataset</code> to an XML element.
-	 * 
-	 * @param dataset
-	 *            the <code>MartDataset</code> to serialize
-	 * @param namespace
-	 *            the <code>Namespace</code> to use when constructing the
-	 *            <code>Element</code>
-	 * @return an XML serialization of the <code>MartDataset</code>
-	 */
-	public static Element datasetToElement(MartDataset dataset,
-			Namespace namespace) {
-		Element element = new Element(MART_DATASET_ELEMENT, namespace);
-		element.setAttribute(DISPLAY_NAME_ATTRIBUTE, dataset.getDisplayName());
-		element.setAttribute(NAME_ATTRIBUTE, dataset.getName());
-		element.setAttribute(TYPE_ATTRIBUTE, dataset.getType());
-		element.setAttribute(INITIAL_BATCH_SIZE_ATTRIBUTE, String
-				.valueOf(dataset.getInitialBatchSize()));
-		element.setAttribute(MAXIMUM_BATCH_SIZE_ATTRIBUTE, String
-				.valueOf(dataset.getMaximumBatchSize()));
-		element.setAttribute(VISIBLE_ATTRIBUTE, String.valueOf(dataset
-				.isVisible()));
-		if (dataset.getInterface() != null) {
-			element.setAttribute(INTERFACE_ATTRIBUTE, dataset.getInterface());
-		}
-		if (dataset.getModified() != null) {
-			element.setAttribute(MODIFIED_ATTRIBUTE, dataset.getModified());
-		}
-		element.addContent(locationToElement(dataset.getMartURLLocation(),
-				namespace));
-		return element;
-	}
-
-	/**
-	 * Creates a <code>MartDataset</code> from an XML element.
-	 * 
-	 * @param element
-	 *            the <code>Element</code> to deserialize
-	 * @param namespace
-	 *            the <code>Namespace</code> containing the
-	 *            <code>Element</code>
-	 * @return a deserialized <code>MartDataset</code>
-	 */
-	public static MartDataset elementToDataset(Element element,
-			Namespace namespace) {
-		MartDataset dataset = new MartDataset();
-		dataset.setDisplayName(element
-				.getAttributeValue(DISPLAY_NAME_ATTRIBUTE));
-		dataset.setName(element.getAttributeValue(NAME_ATTRIBUTE));
-		dataset.setType(element.getAttributeValue(TYPE_ATTRIBUTE));
-		dataset.setInitialBatchSize(Long.parseLong(element
-				.getAttributeValue(INITIAL_BATCH_SIZE_ATTRIBUTE)));
-		dataset.setMaximumBatchSize(Long.parseLong(element
-				.getAttributeValue(MAXIMUM_BATCH_SIZE_ATTRIBUTE)));
-		dataset.setVisible(Boolean.getBoolean(element
-				.getAttributeValue(VISIBLE_ATTRIBUTE)));
-		dataset.setInterface(element.getAttributeValue(INTERFACE_ATTRIBUTE));
-		dataset.setModified(element.getAttributeValue(MODIFIED_ATTRIBUTE));
-		dataset.setMartURLLocation(elementToLocation(element.getChild(
-				MART_URL_LOCATION_ELEMENT, namespace)));
-		return dataset;
-	}
-
-	/**
-	 * Creates a <code>MartRegistry</code> from an XML element.
-	 * 
-	 * @param element
-	 *            the <code>Element</code> to deserialize
-	 * @param namespace
-	 *            the <code>Namespace</code> containing the
-	 *            <code>Element</code>
-	 * @return a deserialized <code>MartRegistry</code>
-	 */
-	public static MartRegistry elementToRegistry(Element root,
-			Namespace namespace) {
-		MartRegistry registry = new MartRegistry();
-		List<Element> children = root.getChildren();
-		for (Element childElement : children) {
-			if (childElement.getNamespace().equals(namespace)) {
-				if (childElement.getName().equals(MART_URL_LOCATION_ELEMENT)) {
-					MartURLLocation martURLLocation = MartServiceXMLHandler
-							.elementToLocation(childElement);
-					martURLLocation.setVirtualSchema("default");
-					registry.addMartURLLocation(martURLLocation);
-				} else if (childElement.getName()
-						.equals(VIRTUAL_SCHEMA_ELEMENT)) {
-					String virtualSchema = childElement
-							.getAttributeValue(NAME_ATTRIBUTE);
-					List<Element> locations = childElement.getChildren(
-							MART_URL_LOCATION_ELEMENT, namespace);
-					for (Element location : locations) {
-						MartURLLocation martURLLocation = MartServiceXMLHandler
-								.elementToLocation(location);
-						martURLLocation.setVirtualSchema(virtualSchema);
-						registry.addMartURLLocation(martURLLocation);
-					}
-				}
-			}
-		}
-		return registry;
-	}
-
-	/**
-	 * Converts a <code>MartURLLocation</code> to an XML element.
-	 * 
-	 * @param location
-	 *            the <code>MartURLLocation</code> to serialize
-	 * @param namespace
-	 *            the <code>Namespace</code> to use when constructing the
-	 *            <code>Element</code>
-	 * @return an XML serialization of the <code>MartURLLocation</code>
-	 */
-	public static Element locationToElement(MartURLLocation location,
-			Namespace namespace) {
-		Element element = new Element(MART_URL_LOCATION_ELEMENT, namespace);
-		if (location.getDatabase() != null) {
-			element.setAttribute(DATABASE_ATTRIBUTE, location.getDatabase());
-		}
-		element.setAttribute(DEFAULT_ATTRIBUTE, location.isDefault() ? "1"
-				: "0");
-		element.setAttribute(DISPLAY_NAME_ATTRIBUTE, location.getDisplayName());
-		element.setAttribute(HOST_ATTRIBUTE, location.getHost());
-		if (location.getIncludeDatasets() != null) {
-			element.setAttribute(INCLUDE_DATASETS_ATTRIBUTE, location
-					.getIncludeDatasets());
-		}
-		if (location.getMartUser() != null) {
-			element.setAttribute(MART_USER_ATTRIBUTE, location.getMartUser());
-		}
-		element.setAttribute(NAME_ATTRIBUTE, location.getName());
-		if (location.getPath() != null) {
-			element.setAttribute(PATH_ATTRIBUTE, location.getPath());
-		}
-		element
-				.setAttribute(PORT_ATTRIBUTE, String
-						.valueOf(location.getPort()));
-		element.setAttribute(SERVER_VIRTUAL_SCHEMA_ATTRIBUTE, location
-				.getServerVirtualSchema());
-		if (location.getVirtualSchema() != null) {
-			element.setAttribute(VIRTUAL_SCHEMA_ATTRIBUTE, location
-					.getVirtualSchema());
-		}
-		element.setAttribute(VISIBLE_ATTRIBUTE, location.isVisible() ? "1"
-				: "0");
-		element.setAttribute(REDIRECT_ATTRIBUTE, location.isRedirect() ? "1"
-				: "0");
-		return element;
-	}
-
-	/**
-	 * Creates a <code>MartURLLocation</code> from an XML element.
-	 * 
-	 * @param element
-	 *            the <code>Element</code> to deserialize
-	 * @return a deserialized <code>MartURLLocation</code>
-	 */
-	public static MartURLLocation elementToLocation(Element element) {
-		MartURLLocation location = new MartURLLocation();
-		location.setDatabase(element.getAttributeValue(DATABASE_ATTRIBUTE));
-		location.setDefault("1".equals(element
-				.getAttributeValue(DEFAULT_ATTRIBUTE)));
-		location.setDisplayName(element
-				.getAttributeValue(DISPLAY_NAME_ATTRIBUTE));
-		location.setHost(element.getAttributeValue(HOST_ATTRIBUTE));
-		location.setIncludeDatasets(element
-				.getAttributeValue(INCLUDE_DATASETS_ATTRIBUTE));
-		location.setMartUser(element.getAttributeValue(MART_USER_ATTRIBUTE));
-		location.setName(element.getAttributeValue(NAME_ATTRIBUTE));
-		location.setPath(element.getAttributeValue(PATH_ATTRIBUTE));
-		try {
-			location.setPort(Integer.parseInt(element
-					.getAttributeValue(PORT_ATTRIBUTE)));
-		} catch (NumberFormatException e) {
-			location.setPort(80);
-		}
-		location.setServerVirtualSchema(element
-				.getAttributeValue(SERVER_VIRTUAL_SCHEMA_ATTRIBUTE));
-		location.setVirtualSchema(element
-				.getAttributeValue(VIRTUAL_SCHEMA_ATTRIBUTE));
-		location.setVisible("1".equals(element
-				.getAttributeValue(VISIBLE_ATTRIBUTE)));
-		location.setRedirect("1".equals(element
-				.getAttributeValue(REDIRECT_ATTRIBUTE)));
-		return location;
-	}
-
-	/**
-	 * Creates a <code>MartQuery</code> from an XML element.
-	 * 
-	 * @param element
-	 *            the <code>Element</code> to deserialize
-	 * @param namespace
-	 *            the <code>Namespace</code> containing the
-	 *            <code>Element</code>
-	 * @return a deserialized <code>MartQuery</code>
-	 */
-	public static MartQuery elementToMartQuery(Element element,
-			Namespace namespace) {
-		MartQuery martQuery = new MartQuery();
-		martQuery.setMartService(MartServiceXMLHandler
-				.elementToMartService(element.getChild(MART_SERVICE_ELEMENT,
-						namespace)));
-		martQuery.setMartDataset(elementToDataset(element.getChild(
-				MART_DATASET_ELEMENT, namespace), namespace));
-		martQuery.setQuery(QueryXMLHandler.elementToQuery(element.getChild(
-				QueryXMLHandler.QUERY_ELEMENT, namespace), namespace));
-		Element linksElement = element.getChild(LINKED_DATASETS_ELEMENT, namespace);
-		if (linksElement != null) {
-			List linkedDatasets = linksElement.getChildren(LINKED_DATASETS_ELEMENT,
-					namespace);
-			for (Iterator iter = linkedDatasets.iterator(); iter.hasNext();) {
-				Element datasetElement = (Element) iter.next();
-				String datasetName = datasetElement.getAttributeValue(NAME_ATTRIBUTE);
-				String linkId = datasetElement.getAttributeValue(LINK_ATTRIBUTE);
-				martQuery.addLinkedDataset(datasetName, linkId);
-			}
-		}
-		return martQuery;
-	}
-
-	/**
-	 * Converts a <code>MartQuery</code> to an XML element.
-	 * 
-	 * @param martQuery
-	 *            the <code>MartQuery</code> to serialize
-	 * @param namespace
-	 *            the <code>Namespace</code> to use when constructing the
-	 *            <code>Element</code>
-	 * @return an XML serialization of the <code>MartQuery</code>
-	 */
-	public static Element martQueryToElement(MartQuery martQuery,
-			Namespace namespace) {
-		Element element = new Element(MART_QUERY_ELEMENT, namespace);
-		element.addContent(martServiceToElement(martQuery.getMartService(),
-				namespace));
-		element.addContent(datasetToElement(martQuery.getMartDataset(),
-				namespace));
-		element.addContent(QueryXMLHandler.queryToElement(martQuery.getQuery(),
-				namespace));
-		Set linkedDatasets = martQuery.getLinkedDatasets();
-		if (linkedDatasets.size() > 0) {
-			Element linksElement = new Element(LINKED_DATASETS_ELEMENT, namespace);
-			for (Iterator iter = linkedDatasets.iterator(); iter.hasNext();) {
-				String datasetName = (String) iter.next();
-				Element datasetElement = new Element(LINKED_DATASETS_ELEMENT, namespace);
-				datasetElement.setAttribute(NAME_ATTRIBUTE, datasetName);
-				datasetElement.setAttribute(LINK_ATTRIBUTE, martQuery
-						.getLink(datasetName));
-				linksElement.addContent(datasetElement);
-			}
-			element.addContent(linksElement);
-		}
-		return element;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartURLLocation.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartURLLocation.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartURLLocation.java
deleted file mode 100644
index 476956d..0000000
--- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/MartURLLocation.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * 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: MartURLLocation.java,v $
- * Revision           $Revision: 1.2 $
- * Release status     $State: Exp $
- * Last modified on   $Date: 2007/10/04 14:15:59 $
- *               by   $Author: davidwithers $
- * Created on 17-Mar-2006
- *****************************************************************/
-package org.biomart.martservice;
-
-import org.ensembl.mart.lib.config.MartLocation;
-
-/**
- * The MartURLLocation contained by the MartRegistry returned by a BioMart web
- * service.
- * 
- * @author David Withers
- */
-public class MartURLLocation implements MartLocation {
-	private static final String URL_TYPE = "URL";
-
-	private String database;
-
-	private boolean defaultValue;
-
-	private String displayName;
-
-	private String host;
-
-	private String includeDatasets;
-
-	private String martUser;
-
-	private String name;
-
-	private String path;
-
-	private int port;
-
-	private String serverVirtualSchema;
-
-	private String virtualSchema;
-
-	private boolean visible;
-
-	private boolean redirect;
-
-	/**
-	 * Returns the database.
-	 *
-	 * @return the database
-	 */
-	public String getDatabase() {
-		return database;
-	}
-
-	/**
-	 * Sets the database.
-	 *
-	 * @param database the new database
-	 */
-	public void setDatabase(String database) {
-		this.database = database;
-	}
-
-	/**
-	 * Returns true if the default flag is set.
-	 * 
-	 * @return true if the default flag is set
-	 */
-	public boolean isDefault() {
-		return defaultValue;
-	}
-
-	/**
-	 * Sets the default flag.
-	 * 
-	 * @param defaultValue
-	 *            the value of the default flag
-	 */
-	public void setDefault(boolean defaultValue) {
-		this.defaultValue = defaultValue;
-	}
-
-	/**
-	 * Returns the displayName.
-	 * 
-	 * @return the displayName.
-	 */
-	public String getDisplayName() {
-		return displayName;
-	}
-
-	/**
-	 * Sets the displayName.
-	 * 
-	 * @param displayName
-	 *            the displayName to set.
-	 */
-	public void setDisplayName(String displayName) {
-		this.displayName = displayName;
-	}
-
-	/**
-	 * Returns the host.
-	 * 
-	 * @return the host.
-	 */
-	public String getHost() {
-		return host;
-	}
-
-	/**
-	 * Sets the host.
-	 * 
-	 * @param host
-	 *            the host to set.
-	 */
-	public void setHost(String host) {
-		this.host = host;
-	}
-
-	/**
-	 * Returns the includeDatasets.
-	 *
-	 * @return the includeDatasets
-	 */
-	public String getIncludeDatasets() {
-		return includeDatasets;
-	}
-
-	/**
-	 * Sets the includeDatasets.
-	 *
-	 * @param includeDatasets the new includeDatasets
-	 */
-	public void setIncludeDatasets(String includeDatasets) {
-		this.includeDatasets = includeDatasets;
-	}
-
-	/**
-	 * Returns the martUser.
-	 *
-	 * @return the martUser
-	 */
-	public String getMartUser() {
-		return martUser;
-	}
-
-	/**
-	 * Sets the martUser.
-	 *
-	 * @param martUser the new martUser
-	 */
-	public void setMartUser(String martUser) {
-		this.martUser = martUser;
-	}
-
-	/**
-	 * Returns the name
-	 * 
-	 * @return the name.
-	 */
-	public String getName() {
-		return name;
-	}
-
-	/**
-	 * Sets the name.
-	 * 
-	 * @param name
-	 *            the name to set.
-	 */
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	/**
-	 * Returns the path.
-	 *
-	 * @return the path
-	 */
-	public String getPath() {
-		return path;
-	}
-
-	/**
-	 * Sets the path.
-	 *
-	 * @param path the new path
-	 */
-	public void setPath(String path) {
-		this.path = path;
-	}
-
-	/**
-	 * Returns the port.
-	 * 
-	 * @return the port.
-	 */
-	public int getPort() {
-		return port;
-	}
-
-	/**
-	 * Sets the port.
-	 * 
-	 * @param port
-	 *            the port to set.
-	 */
-	public void setPort(int port) {
-		this.port = port;
-	}
-
-	/**
-	 * Returns the serverVirtualSchema.
-	 * 
-	 * @return the serverVirtualSchema.
-	 */
-	public String getServerVirtualSchema() {
-		return serverVirtualSchema;
-	}
-
-	/**
-	 * Sets the serverVirtualSchema.
-	 * 
-	 * @param serverVirtualSchema
-	 *            the serverVirtualSchema to set.
-	 */
-	public void setServerVirtualSchema(String serverVirtualSchema) {
-		this.serverVirtualSchema = serverVirtualSchema;
-	}
-
-	/**
-	 * Returns the virtualSchema.
-	 * 
-	 * @return the virtualSchema.
-	 */
-	public String getVirtualSchema() {
-		return virtualSchema;
-	}
-
-	/**
-	 * Sets the virtualSchema.
-	 * 
-	 * @param virtualSchema
-	 *            the virtualSchema to set.
-	 */
-	public void setVirtualSchema(String virtualSchema) {
-		this.virtualSchema = virtualSchema;
-	}
-
-	/**
-	 * Returns true if the location is visible.
-	 * 
-	 * @return Returns the visible.
-	 */
-	public boolean isVisible() {
-		return visible;
-	}
-
-	/**
-	 * @param visible
-	 *            The visible to set.
-	 */
-	public void setVisible(boolean visible) {
-		this.visible = visible;
-	}
-
-	/**
-	 * Returns true if this location is redirected.
-	 * 
-	 * @return the redirect
-	 */
-	public boolean isRedirect() {
-		return redirect;
-	}
-
-	/**
-	 * @param redirect the redirect to set
-	 */
-	public void setRedirect(boolean redirect) {
-		this.redirect = redirect;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.ensembl.mart.lib.config.MartLocation#getType()
-	 */
-	public String getType() {
-		return URL_TYPE;
-	}
-
-	/**
-	 * Returns the display name.
-	 * 
-	 * @return the display name
-	 */
-	public String toString() {
-		return getDisplayName();
-	}
-
-	@Override
-	public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime * result
-				+ ((database == null) ? 0 : database.hashCode());
-		result = prime * result + (defaultValue ? 1231 : 1237);
-		result = prime * result
-				+ ((displayName == null) ? 0 : displayName.hashCode());
-		result = prime * result + ((host == null) ? 0 : host.hashCode());
-		result = prime * result
-				+ ((includeDatasets == null) ? 0 : includeDatasets.hashCode());
-		result = prime * result
-				+ ((martUser == null) ? 0 : martUser.hashCode());
-		result = prime * result + ((name == null) ? 0 : name.hashCode());
-		result = prime * result + ((path == null) ? 0 : path.hashCode());
-		result = prime * result + port;
-		result = prime * result + (redirect ? 1231 : 1237);
-		result = prime
-				* result
-				+ ((serverVirtualSchema == null) ? 0 : serverVirtualSchema
-						.hashCode());
-		result = prime * result
-				+ ((virtualSchema == null) ? 0 : virtualSchema.hashCode());
-		result = prime * result + (visible ? 1231 : 1237);
-		return result;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj)
-			return true;
-		if (obj == null)
-			return false;
-		if (getClass() != obj.getClass())
-			return false;
-		final MartURLLocation other = (MartURLLocation) obj;
-		if (database == null) {
-			if (other.database != null)
-				return false;
-		} else if (!database.equals(other.database))
-			return false;
-		if (defaultValue != other.defaultValue)
-			return false;
-		if (displayName == null) {
-			if (other.displayName != null)
-				return false;
-		} else if (!displayName.equals(other.displayName))
-			return false;
-		if (host == null) {
-			if (other.host != null)
-				return false;
-		} else if (!host.equals(other.host))
-			return false;
-		if (includeDatasets == null) {
-			if (other.includeDatasets != null)
-				return false;
-		} else if (!includeDatasets.equals(other.includeDatasets))
-			return false;
-		if (martUser == null) {
-			if (other.martUser != null)
-				return false;
-		} else if (!martUser.equals(other.martUser))
-			return false;
-		if (name == null) {
-			if (other.name != null)
-				return false;
-		} else if (!name.equals(other.name))
-			return false;
-		if (path == null) {
-			if (other.path != null)
-				return false;
-		} else if (!path.equals(other.path))
-			return false;
-		if (port != other.port)
-			return false;
-		if (redirect != other.redirect)
-			return false;
-		if (serverVirtualSchema == null) {
-			if (other.serverVirtualSchema != null)
-				return false;
-		} else if (!serverVirtualSchema.equals(other.serverVirtualSchema))
-			return false;
-		if (virtualSchema == null) {
-			if (other.virtualSchema != null)
-				return false;
-		} else if (!virtualSchema.equals(other.virtualSchema))
-			return false;
-		if (visible != other.visible)
-			return false;
-		return true;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/ResultReceiver.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/ResultReceiver.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/ResultReceiver.java
deleted file mode 100644
index cc1d062..0000000
--- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/ResultReceiver.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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: ResultReceiver.java,v $
- * Revision           $Revision: 1.2 $
- * Release status     $State: Exp $
- * Last modified on   $Date: 2008/07/31 15:06:49 $
- *               by   $Author: davidwithers $
- * Created on Jan 18, 2008
- *****************************************************************/
-package org.biomart.martservice;
-
-/**
- * An interface for receiving results of a Query.
- * 
- * @author David Withers
- */
-public interface ResultReceiver {
-
-	/**
-	 * Receives a single row from the results of executing a Query.
-	 * 
-	 * This method will be called frequently and should not block.
-	 * 
-	 * @param resultRow
-	 */
-	public void receiveResult(Object[] resultRow, long index) throws ResultReceiverException;
-	
-	/**
-	 * Receives an error for a single row from the results of executing a Query.
-	 * 
-	 * This method will be called frequently and should not block.
-	 * 
-	 * @param resultRow
-	 */
-	public void receiveError(String errorMessage, long index) throws ResultReceiverException;
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/ResultReceiverException.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/ResultReceiverException.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/ResultReceiverException.java
deleted file mode 100644
index c3498e6..0000000
--- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/ResultReceiverException.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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: ResultReceiverException.java,v $
- * Revision           $Revision: 1.1 $
- * Release status     $State: Exp $
- * Last modified on   $Date: 2008/03/04 16:47:57 $
- *               by   $Author: davidwithers $
- * Created on 05-May-2006
- *****************************************************************/
-package org.biomart.martservice;
-
-/**
- * 
- * @author David Withers
- */
-public class ResultReceiverException extends Exception {
-	private static final long serialVersionUID = 7151337259555845771L;
-
-	/**
-	 * Constructs a new exception with no detail message.
-	 * 
-	 */
-	public ResultReceiverException() {
-		super();
-	}
-
-	/**
-	 * Constructs a new exception with the specified detail message.
-	 * 
-	 * @param message
-	 *            the detail message
-	 * @param cause
-	 *            the cause (a null value is permitted, and indicates that the
-	 *            cause is nonexistent or unknown)
-	 */
-	public ResultReceiverException(String message, Throwable cause) {
-		super(message, cause);
-	}
-
-	/**
-	 * Constructs a new exception with the specified detail message and cause.
-	 * 
-	 * @param message
-	 *            the detail message
-	 */
-	public ResultReceiverException(String message) {
-		super(message);
-	}
-
-	/**
-	 * Constructs a new exception with the specified cause.
-	 * 
-	 * @param cause
-	 *            the cause (a null value is permitted, and indicates that the
-	 *            cause is nonexistent or unknown)
-	 */
-	public ResultReceiverException(Throwable cause) {
-		super(cause);
-	}
-
-}